about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiStoreErr.pm
DateCommit message (Collapse)
2023-11-02ds: replace FD map hash table with array
FDs are array indices into the kernel, anyways, so we can take advantage of space savings and speedups because the majority of FDs a big process has is going to end up in the array, anyways.
2023-10-01lei: deal with clients with blocked stderr
lei/store can get stuck if lei-daemon is blocked, and lei-daemon can get stuck when a clients stderr is redirected to a pager that isn't consumed. So start relying on Time::HiRes::alarm to generate SIGALRM to break out of the `print' perlop. Unfortunately, this isn't easy since Perl auto-restarts all writes, so we dup(2) the destination FD and close the copy in the SIGALRM handler to force `print' to return. Most programs (MUAs, editors, etc.) aren't equipped to deal with non-blocking STDERR, so we can't make the stderr file description non-blocking. Another way to solve this problem would be to have script/lei send a non-blocking pipe to lei-daemon in the {2} slot and make script/lei splice messages from the pipe to stderr. Unfortunately, that requires more work and forces more complexity into script/lei and slow down normal cases where stderr doesn't get blocked.
2022-08-15lei_store_err: use level-trigger for error pipe
This fixes deadlocks from errors inside lei/store when multiple errors are spewed.
2021-09-03lei: dump errors to syslog, and not to CLI
Dumping errors from the previous run can often get lost, so just spew to syslog since it's a standard place to put errors that don't make it to a client. Note: we don't rely on $SIG{__WARN__} since some of the Net:: stuff will write directly to STDERR (as will external processes).
2021-08-31lei: fix error reporting from lei/store -> lei-daemon
We must set autoflush to ensure timely notification of clients; and lei-daemon must not block when waiting on reads in case of spurious wakeups. Finally, if no clients are connected to lei-daemon, write to syslog to ensure the error is visible.
2021-04-03lei/store: (more) synchronous non-fatal error output
Since every command that writes to lei/store calls ->done to commit its output, we can rely on that to return a pathname for a readable file with errors in it. Errors can still get crossed up if multiple lei commands are writing to the store at once, but reduces the delay in seeing them and ensures it won't get seen when somebody is attempting to use shell completion.