orthecreedence / cl-async

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

Strange tcp-event callback bug #96

Closed orthecreedence closed 9 years ago

orthecreedence commented 10 years ago

Latest libevent, Linux x64, sbcl 1.2.3.

Email from Sabra:

I followed the instructions on quick start for wookie from http://wookie.beeets.com/docs. The only change was to set the port to 8000.

I pointed the browser to 127.0.0.1:8000/ and got what I expected. So far, so good.

However, if I run apachebench against it for 30 requests and any number of users, it eventually tells me that it had an apr_pollset_poll result of the timeout specified has expired (70007).

I'm trying to catch cl-async errors, but did not notice anything until the repl threw me into the debugger with the following:

​invalid number of arguments: 1
   [Condition of type SB-INT:SIMPLE-PROGRAM-ERROR]

Restarts:
 0: [*ABORT] Return to SLIME's top level.
 1: [ABORT] Abort thread (#<THREAD "repl-thread" RUNNING {1003F380A3}>)

Backtrace:
  0: (CL-ASYNC::TCP-EVENT-CB #.(SB-SYS:INT-SAP #X7FFFE80097D0) 17 #.(SB-SYS:INT-SAP #X7FFFE80095C0))
  1: ((LAMBDA (SB-ALIEN::ARGS-POINTER SB-ALIEN::RESULT-POINTER FUNCTION) :IN "/home/sabra/.cache/common-lisp/sbcl-1.2.3-linux-x64/home/sabra/quicklisp/dists/quicklisp/software/cl-async-20140914-git/tcp.fasl") ..
  2: ("foreign function: call_into_lisp")
  3: ("foreign function: funcall3")
  4: ("foreign function: #x201010F5")
  5: ("foreign function: #x2010DB7BAC")
  6: (SB-INT:SIMPLE-EVAL-IN-LEXENV (CL-ASYNC:WITH-EVENT-LOOP (:CATCH-APP-ERRORS T) (LET* (# #) (CL-ASYNC:SIGNAL-HANDLER 2 #))) #<NULL-LEXENV>)
  7: (EVAL (CL-ASYNC:WITH-EVENT-LOOP (:CATCH-APP-ERRORS T) (LET* (# #) (CL-ASYNC:SIGNAL-HANDLER 2 #))))
  8: (SWANK::%EVAL-REGION "(as:with-event-loop (:catch-app-errors t) ..)
  9: ((LAMBDA NIL :IN SWANK::%LISTENER-EVAL))
 10: (SWANK::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {10061F6D5B}>)
 11: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {10061F6D3B}>)
 12: (SWANK::%LISTENER-EVAL "(as:with-event-loop (:catch-app-errors t) ..)
 13: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(as:with-event-loop (:catch-app-errors t) ..)
 14: (EVAL (SWANK:LISTENER-EVAL "(as:with-event-loop (:catch-app-errors t) ..)
 15: (SWANK:EVAL-FOR-EMACS (SWANK:LISTENER-EVAL "(as:with-event-loop (:catch-app-errors t) ..)
 16: (SWANK::PROCESS-REQUESTS NIL)
 17: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 18: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 19: (SWANK-BACKEND::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {1003F400DB}>)
 20: ((FLET SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/home/sabra/slime/swank-sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {1003F400DB}>)
 21: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* . #1=#<SWANK-BACKEND::SLIME-OUTPUT-STREAM {1003F1F363}>) (*STANDARD-INPUT* . #2=#<SWANK-BACKEND::SLIME-INPUT-STREAM {1006050003}>) (*TRACE-OUTPUT* . #1#)..
 22: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1002FBFDA3}> NIL)
 23: ((FLET #:WITHOUT-INTERRUPTS-BODY-1226 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 24: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 25: ((FLET #:WITHOUT-INTERRUPTS-BODY-647 :IN SB-THREAD::CALL-WITH-MUTEX))
 26: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {7FFFF4B3ED1B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THR..
 27: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "repl-thread" RUNNING {1003F380A3}> #S(SB-THREAD:SEMAPHORE :NAME "Thread setup semaphore" :%COUNT 0 :WAITCOUNT 0 :MUTEX #<SB-THREAD:MU..
 28: ("foreign function: call_into_lisp")
 29: ("foreign function: new_thread_trampoline")
orthecreedence commented 9 years ago

Irrelevant (I think) now that we have libuv