René's URL Explorer Experiment


Title: Deadlock SocketIoSocket.leaveAllRooms vs SocketIoMemoryAdapter.remove · Issue #8 · socketio/socket.io-server-java · GitHub

Open Graph Title: Deadlock SocketIoSocket.leaveAllRooms vs SocketIoMemoryAdapter.remove · Issue #8 · socketio/socket.io-server-java

X Title: Deadlock SocketIoSocket.leaveAllRooms vs SocketIoMemoryAdapter.remove · Issue #8 · socketio/socket.io-server-java

Description: I have a chat system with the back end built on socket.io-server-java. When a client disconnects, the system broadcasts a message to the room that the client was in. This is working very nicely, thank you, except that when multiple clien...

Open Graph Description: I have a chat system with the back end built on socket.io-server-java. When a client disconnects, the system broadcasts a message to the room that the client was in. This is working very nicely, th...

X Description: I have a chat system with the back end built on socket.io-server-java. When a client disconnects, the system broadcasts a message to the room that the client was in. This is working very nicely, th...

Opengraph URL: https://github.com/socketio/socket.io-server-java/issues/8

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deadlock SocketIoSocket.leaveAllRooms vs SocketIoMemoryAdapter.remove","articleBody":"I have a chat system with the back end built on socket.io-server-java.  When a client disconnects, the system broadcasts a message to the room that the client was in.\r\n\r\nThis is working very nicely, thank you, except that when multiple clients leave at almost exactly the same time I hit a deadlock.  The stack trace below demonstrates this.\r\n\r\nThe first thread is processing closing a connection.  It holds the lock to the SocketIoSocket being closed (0x00000007b37007a8) and as part of running SocketIoSocket leaveAllRooms it is waiting on acquiring the lock to the SocketIoMemoryAdapter (0x00000007b3901978) to run its remove method.\r\n\r\nThe second thread is processing closing a connection - I assume from a different client.  As part of that, on \"disconnect\" I have a listener registered that broadcasts a message to a room.  This thread holds the lock to the SocketIoMemoryAdapter (0x00000007b3901978) because it is in the SocketIoMemoryAdapter broadcast method.  Somehow that broadcast is throwing an IOException - I suspect trying to broadcast to the socket that the first thread is in the middle of closing.  As part of processing that exception, it is attempting to close the problematic socket, which includes running SocketIoSocket method leaveAllRooms, and in doing so its trying to acquire the lock on that SocketIoSocket (0x00000007b37007a8).  Hence the deadlock.\r\n\r\nIs this a known limitation, or is it something you could look at fixing please?  Is there any workaround?\r\n\r\nI'm running version 4.0.1 in a a web app deployed as an EAR file in WildFly 26.1.1.\r\n\r\n```\r\n\"default task-572\" #2020 prio=5 os_prio=0 cpu=15.63ms elapsed=6490.38s allocated=14200B defined_classes=0 tid=0x00000203fa9c7000 nid=0x4608 waiting for monitor entry  [0x00000036229fe000]\r\n   java.lang.Thread.State: BLOCKED (on object monitor)\r\n\tat io.socket.socketio.server.SocketIoMemoryAdapter.remove(SocketIoMemoryAdapter.java:92)\r\n\t- waiting to lock \u003c0x00000007b3901978\u003e (a io.socket.socketio.server.SocketIoMemoryAdapter)\r\n\tat io.socket.socketio.server.SocketIoSocket.leaveAllRooms(SocketIoSocket.java:268)\r\n\t- locked \u003c0x00000007b37007a8\u003e (a io.socket.socketio.server.SocketIoSocket)\r\n\tat io.socket.socketio.server.SocketIoSocket.onClose(SocketIoSocket.java:364)\r\n\tat io.socket.socketio.server.SocketIoSocket.onDisconnect(SocketIoSocket.java:357)\r\n\tat io.socket.socketio.server.SocketIoSocket.onPacket(SocketIoSocket.java:336)\r\n\tat io.socket.socketio.server.SocketIoClient.lambda$setup$1(SocketIoClient.java:163)\r\n\tat io.socket.socketio.server.SocketIoClient$$Lambda$3548/0x0000000803770440.call(Unknown Source)\r\n\tat io.socket.socketio.server.parser.IOParser$Decoder.add(IOParser.java:99)\r\n\tat io.socket.socketio.server.SocketIoClient.lambda$setup$2(SocketIoClient.java:171)\r\n\tat io.socket.socketio.server.SocketIoClient$$Lambda$3549/0x0000000803770840.call(Unknown Source)\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n\tat io.socket.engineio.server.EngineIoSocket.emit(EngineIoSocket.java:187)\r\n\tat io.socket.engineio.server.EngineIoSocket.onPacket(EngineIoSocket.java:400)\r\n\tat io.socket.engineio.server.EngineIoSocket.lambda$setTransport$10(EngineIoSocket.java:303)\r\n\tat io.socket.engineio.server.EngineIoSocket$$Lambda$3542/0x0000000803732440.call(Unknown Source)\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n\tat io.socket.engineio.server.Transport.onPacket(Transport.java:102)\r\n\tat io.socket.engineio.server.Transport.onData(Transport.java:111)\r\n\tat io.socket.engineio.server.transport.WebSocket.lambda$new$0(WebSocket.java:26)\r\n\tat io.socket.engineio.server.transport.WebSocket$$Lambda$3556/0x0000000803772440.call(Unknown Source)\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n[...my @OnMessage method in my @ServerEndpoint class]\r\n```\r\n\r\n```\r\n\"default task-558\" #2006 prio=5 os_prio=0 cpu=15.63ms elapsed=6490.39s allocated=60368B defined_classes=0 tid=0x00000203f3b80000 nid=0x52a4 waiting for monitor entry  [0x00000036219fc000]\r\n   java.lang.Thread.State: BLOCKED (on object monitor)\r\n\tat io.socket.socketio.server.SocketIoSocket.leaveAllRooms(SocketIoSocket.java:267)\r\n\t- waiting to lock \u003c0x00000007b37007a8\u003e (a io.socket.socketio.server.SocketIoSocket)\r\n\tat io.socket.socketio.server.SocketIoSocket.onClose(SocketIoSocket.java:364)\r\n\tat io.socket.socketio.server.SocketIoClient.onClose(SocketIoClient.java:206)\r\n\tat io.socket.socketio.server.SocketIoClient.lambda$setup$4(SocketIoClient.java:180)\r\n\tat io.socket.socketio.server.SocketIoClient$$Lambda$3551/0x0000000803771040.call(Unknown Source)\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n\tat io.socket.engineio.server.EngineIoSocket.emit(EngineIoSocket.java:187)\r\n\tat io.socket.engineio.server.EngineIoSocket.onClose(EngineIoSocket.java:369)\r\n\tat io.socket.engineio.server.EngineIoSocket.onError(EngineIoSocket.java:374)\r\n\tat io.socket.engineio.server.EngineIoSocket.lambda$setTransport$8(EngineIoSocket.java:298)\r\n\tat io.socket.engineio.server.EngineIoSocket$$Lambda$3540/0x0000000803732c40.call(Unknown Source)\r\n\tat io.socket.engineio.server.Emitter$OnceListener.call(Emitter.java:37)\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n\tat io.socket.engineio.server.Transport.onError(Transport.java:92)\r\n\tat io.socket.engineio.server.transport.WebSocket.lambda$send$3(WebSocket.java:54)\r\n\tat io.socket.engineio.server.transport.WebSocket$$Lambda$3564/0x0000000803774440.call(Unknown Source)\r\n\tat io.socket.engineio.server.parser.ParserV4.encodePacket(ParserV4.java:36)\r\n\tat io.socket.engineio.server.transport.WebSocket.send(WebSocket.java:58)\r\n\tat io.socket.engineio.server.EngineIoSocket.flush(EngineIoSocket.java:422)\r\n\t- locked \u003c0x00000007b3700bf8\u003e (a java.lang.Object)\r\n\tat io.socket.engineio.server.EngineIoSocket.sendPacket(EngineIoSocket.java:412)\r\n\t- locked \u003c0x00000007b3700bf8\u003e (a java.lang.Object)\r\n\tat io.socket.engineio.server.EngineIoSocket.send(EngineIoSocket.java:114)\r\n\tat io.socket.socketio.server.SocketIoClient.lambda$sendPacket$0(SocketIoClient.java:74)\r\n\tat io.socket.socketio.server.SocketIoClient$$Lambda$3554/0x0000000803771c40.call(Unknown Source)\r\n\tat io.socket.socketio.server.parser.IOParser$Encoder.encode(IOParser.java:37)\r\n\tat io.socket.socketio.server.SocketIoClient.sendPacket(SocketIoClient.java:68)\r\n\tat io.socket.socketio.server.SocketIoSocket.sendPacket(SocketIoSocket.java:382)\r\n\tat io.socket.socketio.server.SocketIoMemoryAdapter.broadcast(SocketIoMemoryAdapter.java:52)\r\n\t- locked \u003c0x00000007b3901978\u003e (a io.socket.socketio.server.SocketIoMemoryAdapter)\r\n\tat io.socket.socketio.server.SocketIoAdapter.broadcast(SocketIoAdapter.java:59)\r\n\tat io.socket.socketio.server.SocketIoNamespaceImpl.broadcast(SocketIoNamespaceImpl.java:32)\r\n\tat io.socket.socketio.server.SocketIoNamespace.broadcast(SocketIoNamespace.java:60)\r\n[...my code that responds to a client disconnecting and broadcasts a message to the room...]\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n\tat io.socket.socketio.server.SocketIoSocket.onClose(SocketIoSocket.java:370)\r\n\tat io.socket.socketio.server.SocketIoSocket.onDisconnect(SocketIoSocket.java:357)\r\n\tat io.socket.socketio.server.SocketIoSocket.onPacket(SocketIoSocket.java:336)\r\n\tat io.socket.socketio.server.SocketIoClient.lambda$setup$1(SocketIoClient.java:163)\r\n\tat io.socket.socketio.server.SocketIoClient$$Lambda$3548/0x0000000803770440.call(Unknown Source)\r\n\tat io.socket.socketio.server.parser.IOParser$Decoder.add(IOParser.java:99)\r\n\tat io.socket.socketio.server.SocketIoClient.lambda$setup$2(SocketIoClient.java:171)\r\n\tat io.socket.socketio.server.SocketIoClient$$Lambda$3549/0x0000000803770840.call(Unknown Source)\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n\tat io.socket.engineio.server.EngineIoSocket.emit(EngineIoSocket.java:187)\r\n\tat io.socket.engineio.server.EngineIoSocket.onPacket(EngineIoSocket.java:400)\r\n\tat io.socket.engineio.server.EngineIoSocket.lambda$setTransport$10(EngineIoSocket.java:303)\r\n\tat io.socket.engineio.server.EngineIoSocket$$Lambda$3542/0x0000000803732440.call(Unknown Source)\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n\tat io.socket.engineio.server.Transport.onPacket(Transport.java:102)\r\n\tat io.socket.engineio.server.Transport.onData(Transport.java:111)\r\n\tat io.socket.engineio.server.transport.WebSocket.lambda$new$0(WebSocket.java:26)\r\n\tat io.socket.engineio.server.transport.WebSocket$$Lambda$3556/0x0000000803772440.call(Unknown Source)\r\n\tat io.socket.engineio.server.Emitter.emit(Emitter.java:123)\r\n[...my @OnMessage method in my @ServerEndpoint class]\r\n```\r\n","author":{"url":"https://github.com/paulthomson78","@type":"Person","name":"paulthomson78"},"datePublished":"2022-11-15T14:52:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/8/socket.io-server-java/issues/8"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:bb133fc5-12fc-c204-db48-daeb8a9f9c2b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE0B4:33DAD9:8EA7F9:C7FC23:6A4E7AAF
html-safe-nonceee8206e58172e05dbb7ca2cf426724e9ee5775c0ef89eaafa9f5ead288112852
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMEI0OjMzREFEOTo4RUE3Rjk6QzdGQzIzOjZBNEU3QUFGIiwidmlzaXRvcl9pZCI6IjE4Njg3MDkyMjM5NTQ1NDUzMjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac68917528156bb82400a5f5fdb7b135220cf7dd07b4d4a0a08c19457ea43f1ad1
hovercard-subject-tagissue:1449913679
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/socketio/socket.io-server-java/8/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ce9bf9ce1f812c9992c1bad7f32b42bfd5dc0c87b342ccd243e88e7fd6d1d5eb/socketio/socket.io-server-java/issues/8
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ce9bf9ce1f812c9992c1bad7f32b42bfd5dc0c87b342ccd243e88e7fd6d1d5eb/socketio/socket.io-server-java/issues/8
og:image:altI have a chat system with the back end built on socket.io-server-java. When a client disconnects, the system broadcasts a message to the room that the client was in. This is working very nicely, th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepaulthomson78
hostnamegithub.com
expected-hostnamegithub.com
None41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c
turbo-cache-controlno-preview
go-importgithub.com/socketio/socket.io-server-java git https://github.com/socketio/socket.io-server-java.git
octolytics-dimension-user_id10566080
octolytics-dimension-user_loginsocketio
octolytics-dimension-repository_id365938076
octolytics-dimension-repository_nwosocketio/socket.io-server-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forktrue
octolytics-dimension-repository_parent_id144740389
octolytics-dimension-repository_parent_nwotrinopoty/socket.io-server-java
octolytics-dimension-repository_network_root_id144740389
octolytics-dimension-repository_network_root_nwotrinopoty/socket.io-server-java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee6a744804e8e70f97b4d5a18a94dcc63db22f97a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/socketio/socket.io-server-java/issues/8#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsocketio%2Fsocket.io-server-java%2Fissues%2F8
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsocketio%2Fsocket.io-server-java%2Fissues%2F8
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=socketio%2Fsocket.io-server-java
Reloadhttps://github.com/socketio/socket.io-server-java/issues/8
Reloadhttps://github.com/socketio/socket.io-server-java/issues/8
Reloadhttps://github.com/socketio/socket.io-server-java/issues/8
Please reload this pagehttps://github.com/socketio/socket.io-server-java/issues/8
socketio https://github.com/socketio
socket.io-server-javahttps://github.com/socketio/socket.io-server-java
trinopoty/socket.io-server-javahttps://github.com/trinopoty/socket.io-server-java
Notifications https://github.com/login?return_to=%2Fsocketio%2Fsocket.io-server-java
Fork 9 https://github.com/login?return_to=%2Fsocketio%2Fsocket.io-server-java
Star 53 https://github.com/login?return_to=%2Fsocketio%2Fsocket.io-server-java
Code https://github.com/socketio/socket.io-server-java
Issues 5 https://github.com/socketio/socket.io-server-java/issues
Pull requests 0 https://github.com/socketio/socket.io-server-java/pulls
Actions https://github.com/socketio/socket.io-server-java/actions
Projects https://github.com/socketio/socket.io-server-java/projects
Security and quality 0 https://github.com/socketio/socket.io-server-java/security
Insights https://github.com/socketio/socket.io-server-java/pulse
Code https://github.com/socketio/socket.io-server-java
Issues https://github.com/socketio/socket.io-server-java/issues
Pull requests https://github.com/socketio/socket.io-server-java/pulls
Actions https://github.com/socketio/socket.io-server-java/actions
Projects https://github.com/socketio/socket.io-server-java/projects
Security and quality https://github.com/socketio/socket.io-server-java/security
Insights https://github.com/socketio/socket.io-server-java/pulse
Deadlock SocketIoSocket.leaveAllRooms vs SocketIoMemoryAdapter.removehttps://github.com/socketio/socket.io-server-java/issues/8#top
https://github.com/paulthomson78
paulthomson78https://github.com/paulthomson78
on Nov 15, 2022https://github.com/socketio/socket.io-server-java/issues/8#issue-1449913679
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.