Re: Bizarre bug with a slot
Could you prepare a minimal compilable example reproducing the problem?
Re: Bizarre bug with a slot
Quote:
Originally Posted by
wysota
Could you prepare a minimal compilable example reproducing the problem?
I'm trying, but I can't even reproduce it in other parts of the same codebase, much less in a pared-down app.
I keep thinking that maybe I'm attaching to the signal twice, but the only time it fires multiple times is if there's a delay (I replaced my insert statement with just a long sleep, and that caused the same effect)
1 Attachment(s)
Re: Bizarre bug with a slot
Quote:
Originally Posted by
wysota
Could you prepare a minimal compilable example reproducing the problem?
OK, after a bit of pain I managed to isolate the problem and produce a compilable example. Note that this bug actually *can* be reproduced under Linux even though I stated earlier that it cannot. You simply have to change the line _sleep(90000) with sleep(90) and this code will produce the same results under Linux.
Re: Bizarre bug with a slot
Well.. this code doesn't compile. It complains _sleep() is undefined. Anyway don't take it personal but sleeping in a slot is a really stupid idea :) And I can imagine some failsafe mechanism kicks in and emits a signal for the second time because of a timeout or something.
Re: Bizarre bug with a slot
Quote:
Originally Posted by
wysota
Well.. this code doesn't compile. It complains _sleep() is undefined. Anyway don't take it personal but sleeping in a slot is a really stupid idea :) And I can imagine some failsafe mechanism kicks in and emits a signal for the second time because of a timeout or something.
Regarding compilation, Note my earlier explanation that under Linux you have to remove the "_" from the sleep function and change the argument from microsectonds to seconds.
At any rate, the sleep is only there to reproduce the bug :)
In the actual code, I am taking the XML I received and inserting into a local SQLite database. The insert loop is taking about a minute or so, and that is where I run into this bug.
If I have an expensive operation to perform as the result of an HTTP request, where else can I execute my code other than in the callback slot? I really don't think re-firing the signal is desirable behavior from the signal/slot mechanism...Is this re-firing documented behavior?
Re: Bizarre bug with a slot
Quote:
Originally Posted by
hardgeus
At any rate, the sleep is only there to reproduce the bug :)
In the actual code, I am taking the XML I received and inserting into a local SQLite database. The insert loop is taking about a minute or so, and that is where I run into this bug.
So make it last a second or don't insert into the database as a reaction to a timer-based signal. Post an event or use a 0 timeout timer to trigger a deffered call.
Quote:
If I have an expensive operation to perform as the result of an HTTP request, where else can I execute my code other than in the callback slot? I really don't think re-firing the signal is desirable behavior from the signal/slot mechanism...Is this re-firing documented behavior?
It's not the same signal. It might be a signal related to timing out something. Anyway I'm just guessing here. Move the query elsewhere and your problem will go away. Otherwise closely examine the second signal to see if it is a copy of the first one.