Skip to content
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

Ignore: ๐Ÿ› Distributed Lock Failure Causing Duplicate Chat Room Joins #236

Merged
merged 4 commits into from
Feb 6, 2025

Conversation

psychology50
Copy link
Member

@psychology50 psychology50 commented Feb 6, 2025

์ž‘์—… ์ด์œ 

image

Initially, I thought the issue was due to a missing validation check for users already joined in a chat room, so I added it. However, after further investigation, I realized that the problem lies elsewhere. (I haven't found the root cause yet.)


์ž‘์—… ์‚ฌํ•ญ

I DON'T KNOW WHY THIS MAKE A ISSUE!!!!!!!!!! ๐Ÿคฏ

image

I found the root cause of the issue through debuggingโ€”duplicate user entries were saved in the chat room.

However, this shouldnโ€™t be possible
I had already anticipated this issue and applied a distributed lock at the service level.
Additionally, the validation to check for duplicate users was being executed in ChatMemberRdbService.createMember()

But it still failed.

Logs Analysis

[2025-02-05 17:03:06:433949759] INFO  1 --- [io-8080-exec-10] k.c.p.d.c.aop.DistributedLockAspect      : 88 : Redisson Lock ์ง„์ž… : execute LOCK:chat-room-join-674887267360394154
[2025-02-05 17:03:35:433979121] INFO  1 --- [io-8080-exec-27] k.c.p.d.c.aop.DistributedLockAspect      : 3429 : Redisson Lock ์ง„์ž… : execute LOCK:chat-room-join-674887267360394154
[2025-02-05 17:03:37:433981077] INFO  1 --- [io-8080-exec-10] k.c.p.d.c.aop.DistributedLockAspect      : 88 : Redisson Lock ํ•ด์ œ : execute LOCK:chat-room-join-674887267360394154
[2025-02-05 17:03:37:433981321] INFO  1 --- [io-8080-exec-27] k.c.p.d.c.aop.DistributedLockAspect      : 3429 : Redisson Lock ํ•ด์ œ : execute LOCK:chat-room-join-674887267360394154
[2025-02-05 17:03:39:433982954] ERROR 1 --- [io-8080-exec-10] k.c.p.d.c.aop.DistributedLockAspect      : Redisson lock is already unlocked: execute LOCK:chat-room-join-674887267360394154
  1. Thread ID 88 acquires the lock and starts execution at 17:02:50.
  2. Thread ID 3429 acquires the lock and starts execution at 17:03:34.
  3. The lock for Thread ID 88 is released at 17:03:37.
  4. The lock for Thread ID 3429 is released at 17:03:37.

These logs clearly indicate that two threads acquired the lock simultaneously. ๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚

Iโ€™ve been trying to reproduce the issue under the same conditions, but I haven't been able to.


๋ฆฌ๋ทฐ์–ด๊ฐ€ ์ค‘์ ์ ์œผ๋กœ ํ™•์ธํ•ด์•ผ ํ•˜๋Š” ๋ถ€๋ถ„

  • For now, Iโ€™m pausing the investigation on this issue since I need to focus on another urgent task.
  • Will revisit once I have more bandwidth.

๋ฐœ๊ฒฌํ•œ ์ด์Šˆ

  • Redisson lock failure allowed simultaneous thread execution.
  • Need further investigation to determine why the distributed lock mechanism failed.

@psychology50 psychology50 added bug ๊ธด๊ธ‰ํ•˜๊ณ , ์ค‘์š”๋„๊ฐ€ ๋†’์€ ์ด์Šˆ fix ๊ธฐ๋Šฅ ์ˆ˜์ • labels Feb 6, 2025
@psychology50 psychology50 self-assigned this Feb 6, 2025
@psychology50 psychology50 changed the title Ignore: ๐Ÿ› A Gap in Preventing Duplicate Chat Room Joins Ignore: ๐Ÿ› Distributed Lock Failure Causing Duplicate Chat Room Joins Feb 6, 2025
@psychology50 psychology50 marked this pull request as ready for review February 6, 2025 13:13
@psychology50 psychology50 merged commit a66568d into dev Feb 6, 2025
1 check passed
@psychology50 psychology50 deleted the fix/move-authorize-check-in-join-chatroom branch February 6, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ๊ธด๊ธ‰ํ•˜๊ณ , ์ค‘์š”๋„๊ฐ€ ๋†’์€ ์ด์Šˆ fix ๊ธฐ๋Šฅ ์ˆ˜์ •
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant