quickfix icon indicating copy to clipboard operation
quickfix copied to clipboard

Do we need a mutex in FieldMap ?

Open sylr opened this issue 1 year ago • 2 comments

In https://github.com/quickfixgo/quickfix/pull/485 a mutex has been added to FieldMap to make it Thread Safe.

However, in the same PR, the Message pool mechanism has also been removed so Messages are not re-used any longer and it's up to the Go garbage collector to free unused messages.

In that context I fail to see a scenario where a Message and the underlying FieldMaps need to be thread safe.

Can someone share a use case where a message is concurrently read/updated ?

cc @waheedoo @ackleymi

sylr avatar Oct 24 '24 15:10 sylr

I was asking myself the same question. We got bitten by slow reads from parsed message since every field is protected mutex lock slowing down the processing. I would prefer no locking of messages especially if they are no longer reused.

If you need to lock the FieldMap you should do it outside in your own code (this would also improve when getting or setting multiple fields).

matejsp avatar Dec 18 '24 14:12 matejsp

@waheedoo @ackleymi could we get your input on this matter.

sylr avatar Feb 25 '25 16:02 sylr