-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Session expiration not threadsafe #203
Comments
I think an effect of this was just reported as #204. |
yes, traces of goroutine 10 and 1227 fully match the problem. This ticket is just more general, as similar code is different places. |
I'm for a getting a fix quicker by putting a mutex around those maps (so solution 1). I'm thinking to make a "map + mutex" type in |
Agreed. Let's identify and fix our multithreading issues first. |
May I suggest to split the map per core to avoid the scalability bottleneck? Because, if one uses AF_PACKET in FANOUT_HASH mode, packets from a flow are delivered to the same core. So, session expiration could be sent out as transaction expired events to the main loop per core. However, looking at the current code, there is no support for using AF_PACKET in fanout mode (which provides a lot more scalability than the stated 200K packets per second). So some machinery would have to be added to have multiple TPacket sockets and distributing them one per core. Gopacket has AF_PACKET fanout support builtin. |
Yes, fanout is not supported yet. For all the different protocols we support the transaction expiration pattern using timeouts is very common. We might want to add some special special expiration (timer) support that helps contributors with these kinds of issues (like multiplexing timers on same goroutine processing packets). When we add fanout I'm all in for reducing shared state aggressively. |
Issue #203 - Protecting protocol maps against concurrent modifications.
…mutex Issue elastic#203 - Protecting protocol maps against concurrent modifications.
Edits to Getting Started topic
Session expiration is not threadsafe.
Documentation for time.AfterFunc says:
The expire functions simply drops the transaction from internal map. But maps are not thread safe. With golang 1.5 release on august 19th with GOMAXPROCS=(number of logical CPUs) by default tables might get corrupted by chance.
Some possible solutions:
The text was updated successfully, but these errors were encountered: