-
Notifications
You must be signed in to change notification settings - Fork 241
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
DFS: Cache gen. timeout check only when needed #1436
DFS: Cache gen. timeout check only when needed #1436
Conversation
Only check cache generation timeout when generation has actually started. Avoids SQL error.
Only check cache generation timeout when generation has actually started. Avoids SQL error.
This reverts commit 19f7a22.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks "ok" to me, bu I don't know this part that well so maybe @bdunogier can give some insights if this is ok as well.
Yes.
To be honest, I'm not sure I can really help there any longer. Your analysis sounds correct, @glye. Semantically speaking, it would be both more correct and more meaningful to test this in a dedicated method. Instead of adding an |
Ack, moved to |
Only check cache generation timeout when generation has actually started. Avoids SQL error.
Mmm, what if cache generation was started by another process/thread? Would any piece of code call in that scenario |
Actually, I would have returned false in that case, @glye. If we don't have a timestamp, we can't store, can we ? |
It seems that the only entrypoint to this hairyball is towards the end of My question above then becomes: in which scenario does ps: not having 'protected' and 'public' method modifiers makes control flow analysis of the codebase so much hareder... :-( |
@gggeek It should afaik be reading the start timestamp from the shared db, but there could be a race condition where this sometimes doesn't work as expected. @bdunogier |
I'd rather be very protective here @glye: we are in an unidentified case (race condition is a candidate indeed). I think that in that case, it is safe to generate the result, and not even try to store it. If several try to store at the same time, that's when more races occur. Worst case, nobody does because of the race, and it will happen later. Worstest case, nobody ever generates it...
|
@gggeek Sorry, already merged before you joined in, and I'm leaving for 3 weeks. No releases likely in that time, anyway. But if you and @bdunogier agree on reverting, I'll do that. |
Maybe we should revert it until we have settled the discussion ? |
I'll also be away from keyboard for 2 weeks :-D |
Reverted. |
Only check cache generation timeout when generation has actually started, to avoid SQL error.
Calling
DFSHandler::checkCacheGenerationTimeout()
leads to an SQL error if cache generation hasn't started. In that case, the start timestamp isfalse
which ends up as an empty string in the mysqli query. Fix this by not checking, when the timestamp is false. Also fixes CS.Open questions:
Would it be more correct to fix this withinDone.checkCacheGenerationTimeout()
?