Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tclEpollNotfy PlatformEventsControl panics if websocket disconnected

Closed / Fixed010d8f3885642212cf2c65036dd4ad444e9f769eCreated 2 years agoUpdated 272 days ago
About ticket 010d8f3885642212cf2c65036dd4ad444e9f769e

Now in branch fix-010d8f3885-tclEpollNotfy-websocket-panic and ready for review before merging

Descriptionplain2024-12-01 23:42:44
The tclEpollNotfy PlatformEventsControl function panics if the TclOSfstat call returns -1, which occurs when using a websocket to a browser and the browser page is refreshed. 

Jan suggested changing the Panic call to LIST_REMOVE(filePtr, readyNode) to remove the filePtr from the hash table as that is more appropriate during the deletion of the handle, but that changes the behavior from a panic to a SIGSEGV.

Tested on Ubuntu 22.04.4 LTS.   Doesn't affect 8.6 since that doesn't have ePoll support on Linux.
Referenced by3
  • 23870dbbb8Closed ticket [b0e16e3f34]: Crash (Tcl_Panic) when closing a file channel plus 4 other changes ticket2026-10-12 19:33:22
  • e3ffca215e(cherry-pick): Fix [010d8f3885] tclEpollNotfy PlatformEventsControl panics if websocket disconnected check-in2025-04-07 09:41:52
  • 5c274ca404Fix [010d8f3885] tclEpollNotfy PlatformEventsControl panics if websocket disconnected check-in2025-04-07 04:20:04
stevel Ticket [010d8f3885]: 3 changes [History diff]2024-12-01 23:43:12
dkfmarkdown2024-12-02 14:13:55

At the moment, it seems that the fstat call isn't doing anything useful. In particular, the contents of the statbuf aren't examined afterwards on success; at best, it changes what message we panic with.

stevelplain2024-12-02 23:59:41
I've confirmed that just returning from PlatformEventsControl rather than a panic does avoid the crash.  So that's a workaround albeit at the cost of a memory leak.  Is that sufficient or should we keep looking for a better solution?
oehharwiki2025-03-24 10:16:18

Dear Steve, dear Donal, thanks for this great action. Is the current source code comment sufficiant? Would it feasable to mention this ticket in a source code comment?

I am wondering, why this ticket is shown as "new wiki page" in fossil timeline. Is it me?

Thanks for all, Harald

stevelplain2025-03-24 11:38:45
Comments added, link fixed
stevel Closed ticket [010d8f3885]. [History diff]2025-04-07 04:20:45
jan.nijtmanswiki2026-03-06 09:31:11

Fixed [here]. No problems with it reported.

If this change causes newly found problems (which is not expected), please re-open this ticket

Log in (anonymous is fine) to add a comment.

Attachments: