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

FastEvent使用的一个问题 #64

Closed
hetinggithub opened this issue Jun 10, 2019 · 1 comment
Closed

FastEvent使用的一个问题 #64

hetinggithub opened this issue Jun 10, 2019 · 1 comment

Comments

@hetinggithub
Copy link

FastEvent 中Order Trade等对象都是预先New分配的,在CoreEngineServiceImpl类中onOrder方法直接使用 orderMap.put(order.getRtOrderID(), order);
缓存该Order。
这会导致如果RingBuf重复使用的时候, orderMap之前的order的值会被后续的事件给修改掉。虽然你目前缓存buf是65536 , 对于order没有类似问题, 但对于tick可能会有隐患。

@sun0x00
Copy link
Owner

sun0x00 commented Jun 11, 2019

@hetinggithub 是的,可能有此隐患,由于目前系统中事件类型都比较确定,事件发出的情形和字段填充的方式一致,旧值会被覆盖,且事件消费速度大于事件产生速度,RingBuf的事件没有被长时间引用的场景,所以这个问题没有触发。在未发布的新版本中由于使用了protobuf,不再使用类似于字段传值的onXXX方法。但显然,RingBuf的事件对象实例依然应该避免被其他线程长时间引用。

@sun0x00 sun0x00 closed this as completed Jun 11, 2019
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

2 participants