PySCXML icon indicating copy to clipboard operation
PySCXML copied to clipboard

Dropped Events

Open fabb opened this issue 12 years ago • 5 comments

When doing sends right after each other, the second event might be ignored. Problem does not happen when sleeping between sends.

See https://gist.github.com/fabb/5014867

fabb avatar Feb 22 '13 19:02 fabb

Python 2.7, Win 7 64bit, PySCXML 0.8.3 if it helps.

fabb avatar Feb 23 '13 12:02 fabb

Strange, it only happens when executing the module with Eclipse PyDev. In the windows console, it always works fine.

Flushing stderr also won't help. Any other idea what might go wrong?

fabb avatar Feb 23 '13 14:02 fabb

hm, odd. i've never come across the issue, and I develop pyscxml using pydev. not on windows, however, so can't really help you there... if you figure it out, be sure to let us know!

jroxendal avatar Feb 28 '13 19:02 jroxendal

Some more I found out: The second event is not dropped, it sits unprocessed in the StateMachine's interpreter.externalQueue.queue. When I call eventlet.greenthread.sleep() in the end of my client program, the event gets processed fine.

More info: In the first send event, due to eventlet.greenthread.sleep() the interpreter's mainEventLoop is waken up (from sleep in line 97), processes the event, and sleeps again at the same line. Everything fine. In the second event, eventlet.greenthread.sleep() is called, but the interpreter's mainEventLoop is NOT waken up.

It seems as the method of using eventlet.greenthread.sleep() to signal the mainEventLoop to continue running is not guaranteeing a deterministic execution.

fabb avatar Feb 28 '13 21:02 fabb

Thanks, I'll have a closer look.

jroxendal avatar Feb 28 '13 21:02 jroxendal