Balazs Scheidler <bazsi@balabit.hu> writes:
On Sat, 2011-10-29 at 13:38 +0200, Balazs Scheidler wrote:
This is cool stuff, but again doesn't compile with a stock json-c.
Hmm.. this time I've checked, newer json-c versions do install the referenced headers. Then I guess it's it needs an updated version number in configure.in.
I've integrated this, but I may have been a bit too fast handed. There's no locking in json-parser(), which will cause things to go bad if threaded(yes) is enabled in the configuration.
Note to self: turn on threaded(yes) already.
And while looking further, $(format-json) is not either, as I've noticed that value-pairs() is not thread safe either, because it uses a similar GString instance that can be used from multiple threads.
Can you look into making them thread safe?
One way to do that is to allocate a new GString instance at every invocation, which is not nice as that increases malloc() load.
I could do that, and probably will do so temporarily (patches will be sent to the list, and I'll try a git pull request aswell, too, to check how my setup can handle that).
The alternative idea I was playing with was to create a new API for managing per-thread scratch buffers that could be reused even between multiple independent portions of syslog-ng. [...] With this API, the required number of GString buffers would be allocated on-demand, but still they would not increase the malloc() load too much, as the scratch buffers subsystem can keep GString instances around. The code using GString buffers become simpler too, as the allocation to store it somewhere vanishes.
What do you think?
Sounds good. I'll play with it during the long weekend, and see how far I get. -- |8]