Opened 4 years ago

#291 new defect

Dumping large amounts to stderr shouldn't deadlock

Reported by: adehnert@mit.edu Owned by:
Priority: major Milestone:
Component: internals Keywords:
Cc:

Description

It appears that right now if a BarnOwl module dumps a large amount to stderr (eg, Adam's Zulip module if you call :zulip:login in ~/.owl/startup with a bad or missing Zulip config file), BarnOwl will deadlock. Obviously dumping tons to stderr is not ideal, but it should probably recover better. My assumption (without looking at the code) is that right now we're draining the stderr pipe in the event loop, and so we deadlock if we dump more than the pipe buffer in one iteration.

It seems like it might be reasonable to do something like drain the pipe in a separate thread, buffer up to some amount, and then add it to the error log in some fashion, with overflow getting reported but thrown away. I guess one option for adding to the error log would be to replace the current single (I assume) pipe with two. One pipe would be used as stderr and be read by a second thread. That thread would write to the other pipe, using the pipe capacity functions (http://man7.org/linux/man-pages/man7/pipe.7.html) to make sure it doesn't (over)fill it. That second pipe could then be used in the event loop as now.

Change History (0)

Note: See TracTickets for help on using tickets.