Skip to content

Conversation

@cesnietor
Copy link
Collaborator

@cesnietor cesnietor commented Jun 3, 2024

There is a race condition while accessing the cancelContext map.
Since we delete and add values to it in goroutines we need to be sure there's no race condition.

This code is using a different pattern than that of trace or watch.

minio:goroutine 48288759572 [running]:
minio:runtime.fatal({0x2b2b988?, 0xc09d250001?})
minio:~runtime/panic.go:1096 +0x5c fp=0xc4791a7ad0 sp=0xc4791a7aa0 pc=0x43b8bc
minio:runtime.mapaccess1_fast64(0x26b9600, 0xc2c32bf740, 0x6)
minio:~runtime/map_fast64.go:22 +0x57 fp=0xc4791a7af0 sp=0xc4791a7ad0 pc=0x4148d7
minio:github.com/minio/console/restapi.(*wsMinioClient).objectManager.func2.1()
minio:~github.com/minio/console@v0.40.0/restapi/ws_objects.go:102 +0x273 fp=0xc4791a7fe0 sp=0xc4791a7af0 pc=0x16d9af3

Test Steps:

  • On Object browser
  • List objects
  • interact with them
  • With a versioned bucket
  • upload different versions for one
  • rewind versions for objects

@cesnietor cesnietor requested review from dvaldivia and vadmeste June 3, 2024 20:14
@cesnietor cesnietor self-assigned this Jun 3, 2024
@cesnietor cesnietor requested a review from reivaj05 June 3, 2024 20:16
@cesnietor cesnietor marked this pull request as ready for review June 4, 2024 22:15
Copy link
Member

@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use sync.Map() @cesnietor

@cesnietor
Copy link
Collaborator Author

cesnietor commented Jun 4, 2024

use sync.Map() @cesnietor

@harshavardhana what are the advantages of it? other than repetitive code?
I need more feedback than just that haha.
I saw we would lose the type check.

@cesnietor cesnietor force-pushed the use-mutext-for-ws-cancelcontexts-map branch from b651f6b to 546e322 Compare June 4, 2024 22:31
@harshavardhana
Copy link
Member

use sync.Map() @cesnietor

@harshavardhana what are the advantages of it? other than repetitive code? I need more feedback than just that haha. I saw we would lose the type check.

It avoids map and mutex. Just one data structure and simpler to use.

@cesnietor cesnietor enabled auto-merge (squash) June 5, 2024 17:18
@cesnietor cesnietor changed the title Use mutex for websocket cancelContext map Use sync.Map for websocket cancelContext map Jun 5, 2024
@cesnietor cesnietor requested a review from prakashsvmx June 5, 2024 21:51
@kannappanr
Copy link

@cesnietor PTAL build failure

@cesnietor
Copy link
Collaborator Author

@cesnietor PTAL build failure

@kannappanr build works, is just the vulnerability check, which can be addressed in other PR.

@harshavardhana harshavardhana disabled auto-merge June 6, 2024 18:38
@harshavardhana harshavardhana enabled auto-merge (squash) June 6, 2024 18:38
@harshavardhana harshavardhana disabled auto-merge June 6, 2024 18:38
@harshavardhana harshavardhana merged commit cf05d50 into minio:master Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants