-
-
Notifications
You must be signed in to change notification settings - Fork 6
weird hang when execute TWO tests one-by-one (both use trace API) #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We have to use following syntax to STOP trace session:
(i.e. only using its ID rather than name).
This way seems to me poor because it strongly depends on FORMAT of 'fbtracemgr -list' output. PS. |
In script - yes, need to parse (though in 1 line using shell and Unix utilities). But in python program one gets session name in service reply in separate clumplet, i.e. finding it is trivial. |
The qa plugin does not use arbitrary or fixed session ID, it uses the session ID reported back by service when session is started. Well, the firebird-driver have to parse the text output to get it, but anyway. The qa plugin also checks that trace was properly stopped, as the service response to stop request is normally "Trace session ID N stopped". This check is actually the reason why this Firebird issue was discovered. |
Sorry - you are absolutely right, problem is badly written test. |
I still have a question about why pytest HANGED after show final message about failed test (i.e. when bug was not yet fixed).
Pay note at line #42: If we comment it out then running this test on v4.0.3.2861, Classic, lead to following console output:
And pytest will infinitely HANG, w/o returning control to OS until we press Ctrl-C. Pressing Ctrl-C leads to following additional output:
And only after that control will returned to OS. PS. firebird.conf:
|
Hi Pavel,
the explanation why pytest hangs is actually quite simple. The trace
session runs in separate thread. If no error in service query happens,
it ends when trace session is stopped. Because due to Firebird bug the
session did not stop properly, the thread is not ended and Python
"hangs" on exit (waiting for thread to finish).
I did not (deliberately) added a measure to qa plugin to stop trace
thread explicitly (a signal/event to break the service query loop) as
it's it complicates things significantly and it's pointless unless there
is a BUG in Firebird.
best regards
Pavel
|
On 10/29/22 11:54, Pavel Císař wrote:
Hi Pavel,
the explanation why pytest hangs is actually quite simple. The trace
session runs in separate thread. If no error in service query happens,
it ends when trace session is stopped. Because due to Firebird bug the
session did not stop properly, the thread is not ended and Python
"hangs" on exit (waiting for thread to finish).
I did not (deliberately) added a measure to qa plugin to stop trace
thread explicitly (a signal/event to break the service query loop) as
it's it complicates things significantly and it's pointless unless there
is a BUG in Firebird.
On my mind test suite should be ready to do it's best when there is a
bug - at least it's designed to detect that bugs ;)
I do not insist on changes but do not think that adding:
- break on error return from service stop call,
- timeouts when working with services and break when exceeded,
significantly complicates the code.
|
Pavel,
Dne 31. 10. 22 v 14:12 Alexander Peshkov napsal(a):
On my mind test suite should be ready to do it's best when there is a
bug - at least it's designed to detect that bugs ;)
Well, it does, most times ;-)
I do not insist on changes but do not think that adding:
- break on error return from service stop call,
- timeouts when working with services and break when exceeded,
significantly complicates the code.
Well, the main problem is that query to get next chunck (to EOF or
single line) of trace data BLOCKs (i.e. the trace thread is actually
waiting for service query call to finish, so it couldn't do anything
else). The only way to get around it is using timeout for service query
call, but current implementation of firebird-driver does not support
service query with timeout, as I was not able to find a reliable way to
support this that would fit the driver API (I'd like avoid backward
incompatible changes), and that will also fit the architecture (support
for Python iterator protocol etc.).
I would definitely like to add timeouts to firebird-driver sometime in
future (as nice to have, at least for trace), but it's definitely not
something that I could hack in single day. Also, as nobody so far (over
all those years that I develop Python Firebird drivers) asked for
service query timeout support (except lately for trace), it was never on
top of my priority list.
regards
Pavel
|
Pavel, I've used to fix two bugs in firebird (FirebirdSQL/firebird#7359 & FirebirdSQL/firebird#7361) related with subj. Currently I can say for sure - used in trace-related tests method to stop service via fixed session ID is not reliable. Nobody can guarantee that after session with ID == N will take place N+1, it may reset to 1, and this is normal behavior, specially for CS.
From what Pavel Zotov says mention method is built into test suite. Can you confirm this? If yes, a way to make behavior stable should be found - for example check for correct session name in sessions list.
The text was updated successfully, but these errors were encountered: