Bug 4156: Work around commStartHalfClosedMonitor() assertion#1442
Bug 4156: Work around commStartHalfClosedMonitor() assertion#1442uhliarik wants to merge 1 commit intosquid-cache:masterfrom
Conversation
|
Can one of the admins verify this patch? |
|
I have easily reproduced the crash with the latest squid 6.1: GDB backtrace: |
|
After applying patch from https://bugs.squid-cache.org/show_bug.cgi?id=4156#c18 , squid is not crashing anymore. |
| } | ||
|
|
||
| debugs(5, 5, "adding FD " << fd << " to " << *TheHalfClosed); | ||
| assert(isOpen(fd) && !commHasHalfClosedMonitor(fd)); |
There was a problem hiding this comment.
If you want to work around this assertion without fixing the underlying bug, then the condition of the proposed new if statement would have to change to become specific to the condition(s) in this assertion. And the handling of that condition would have to be changed to printing an Squid BUG 4156: ... ERROR, probably followed by return; (but that needs to be tested -- I do not know enough about this bug to propose the exact workaround).
Do you know what assertion condition is failing, isOpen(fd) or !commHasHalfClosedMonitor(fd)? If you do not, you can find out by splitting that assert() into two, the way it should have been written:
| assert(isOpen(fd) && !commHasHalfClosedMonitor(fd)); | |
| assert(isOpen(fd)); | |
| assert(!commHasHalfClosedMonitor(fd)); |
One of the above assertions should fail in your tests (without the proposed if statement workaround!). Once we know which assertion fails (without the proposed if statement), we can start working on adjusting the proposed if statement accordingly.
Needless to say, it would be much better to actually fix the bug, but I do not have enough free time right now to triage and volunteer a proper fix, unfortunately.
| { | ||
| if (!TheHalfClosed->empty()) { | ||
| debugs(5, 5, HERE << "half_closed is on fd = " << fd ); | ||
| commCallCloseHandlers(fd); |
There was a problem hiding this comment.
commStartHalfClosedMonitor() should not Call Close Handlers. Close handlers should be called on read errors. And they should remain set until the connection is actually being closed. I know this change stops the assertion from happening, but so does disabling the obviously broken half_closed_client feature. The change is trading a loud assertion for silent uncertainty. This is a bad tradeoff IMO.
I am suggesting a path towards a possibly acceptable workaround in a dedicated change request.
|
Hello Alex! Thank you for your explanation. I have divided the condition into two parts so now I can say for sure which function call is triggering the assertion - it is |
Thank you for sharing that information. I posted a fix for this bug as PR #1443. |
No description provided.