orthecreedence / cl-async

Asynchronous IO library for Common Lisp.
MIT License
272 stars 40 forks source link

Improve event loop shutdown diagnostics, reenable PIPE-CONNECT-FAIL test. #119

Closed ivan4th closed 9 years ago

ivan4th commented 9 years ago

No longer enter infinite loop when there are handles that cannot be closed for some reason. Do at most 100000 iterations, then show warning and dump currently active handles. I encounter event loop shutdown problems from time to time and this will perhaps be of some help with debugging.

PIPE-CONNECT-FAIL was probably hanging due to HANDLE-TYPE problem in cl-libuv, see orthecreedence/cl-libuv#3

orthecreedence commented 9 years ago

Awesome, thanks.

Does returning (values) from the walk-cb keep it from segfaulting? I was wondering why that was happening.

orthecreedence commented 9 years ago

Weird, pipe-connect-fail works on linux but not windows. I'm going to try compiling the latest libuv, because it seems it's not honoring uv_close on the pipe.

ivan4th commented 9 years ago

No, (values) are returned from (dump-event-loop-status) / (do-close-loop) for purely cosmetic reasons. The problem was in cl-libuv. How does PIPE-CONNECT-FAIL test fail now on windows? Does it segfault or does it say "failed to do loop cleanup"?

orthecreedence commented 9 years ago

It doesn't say anything, it freezes. The call to uv_run just never returns after running do-close-loop.. The problem is that we call uv_close on a pipe and the close callback never runs, nor does libuv report any errors (ie "You can't close an already closed stream").

I really think it may be a libuv bug, but I'm going to do more tracing tonight if I get some time and see if I can find anything I missed last night.