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

Rare bug caused by concurrent map read and write #36

Open
alankm opened this issue Jul 12, 2018 · 2 comments
Open

Rare bug caused by concurrent map read and write #36

alankm opened this issue Jul 12, 2018 · 2 comments

Comments

@alankm
Copy link

alankm commented Jul 12, 2018

From 'handler.go':

line 63
delete(connections, conn)

line 94
connections[conn] = true

All of this logic occurs within a 'http.Handler', and is therefore multi-threaded. There are currently no safeguards against concurrent map read and map write. Perhaps this map should be replaced with a 'sync.Map' from the standard library?

@alankm
Copy link
Author

alankm commented Jul 12, 2018

Actually, does this map need to exist at all? As far as I can see it's never being read from, and my code runs fine without it.

@alankm
Copy link
Author

alankm commented Aug 1, 2018

Found another one caused by the "RemoveSubscriptions" function on a "subscriptionManager".

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

No branches or pull requests

1 participant