I was doing some pub&sub test with autobahn-cpp. However, I found that when you pub some data at a frequency that faster than the sub endpoint can consume, this will cause the router(crossbar) cache some data and the memory usage increases. Eventually, the router will use up all the memory and be killed by the os.
For example
publisher:
while(1)
{
session->publish("com.pub.test",std::make_tuple(std::string("hello, world")) );
std::this_thread::sleep_for(std::chrono::seconds(1)); // sleep 1s
} // pub a string every seconds
subscriber:
void topic1(const autobahn::wamp_event& event)
{
try
{
auto s = event.argument<std::string>(0);
std::cerr << s << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(2)); //need 2s to finish the job
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
main()
{
...
session>subscribe("com.pub.test", &topic1);
...
} // pub runs faster than the sub can consume
After several housr:
2016-01-7 10:11:32+0000 [Controller 16142] Worker 16145: Process connection gone (A process has ended with a probable error condition: process ended by signal 9.)
dmsg:
Out of memory: Kill process 16145(Crossbar.io Wor) score 4 or sacrifice child
My questions:
- Is this normal (use up all the memory and be killed by the os) ?
- Or is there any config options can be set to limit the memory usage?
I found a similar issue, see link https://github.com/crossbario/crossbar/issues/48
system info: ubuntu 14.04(32bit), CPython 2.7.6, Crossbar.io 0.11.1, Autobahn 0.10.9