Thread safety of cobalt syslog/syslogv call
Hello,
I was wondering whether or not the syslog/vsyslog calls in cobalt runtime libs are thread safe. I observer strange behaviour in my logs under heavy log load.
Thanks
François
Quoted 4 lines · François Legal
Hello,
I was wondering whether or not the syslog/vsyslog calls in cobalt runtime libs are thread safe. I observer strange behaviour in my logs under heavy log load.
Can you be more precise in what you do? And which parts of lib/cobalt/printf.c you consider problematic /wrt thread safety, the printout to syslog or the wrapper functions themselves?
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 12 lines · Jan Kiszka
Quoted 4 lines · François Legal
Hello,
I was wondering whether or not the syslog/vsyslog calls in cobalt runtime libs are thread safe. I observer strange behaviour in my logs under heavy log load.
Can you be more precise in what you do? And which parts of
lib/cobalt/printf.cyou consider problematic /wrt thread safety, the printout to syslog or the wrapper functions themselves?Jan
I have a set of threads that would each send to syslof under certain conditions. In my syslog, I can see a bunch of truncated log entries. I'd first though that maybe RT_PRINT_DEFAULT_BUFFER & RT_PRINT_DEFAULT_BUFFERS_COUNT would be too small in my application, but increasing those values did not make any differences. I ended up looking at the code and got to vprint_to_buffer that should be called when I want to send an entry to syslog in my RT threads, and was wondering (I believe it is not) whether or not this function was thread safe.
Am I getting something wrong ?
François
Quoted 4 lines
--
Siemens AG, Technology
Linux Expert Center
Quoted 12 lines · François Legal
Quoted 10 lines · Jan Kiszka
Quoted 4 lines · François Legal
Hello,
I was wondering whether or not the syslog/vsyslog calls in cobalt runtime libs are thread safe. I observer strange behaviour in my logs under heavy log load.
Can you be more precise in what you do? And which parts of
lib/cobalt/printf.cyou consider problematic /wrt thread safety, the printout to syslog or the wrapper functions themselves?
Quoted 6 lines
Quoted 2 lines
Jan
I have a set of threads that would each send to syslof under certain conditions. In my syslog, I can see a bunch of truncated log entries. I'd first though that maybe
RT_PRINT_DEFAULT_BUFFER&RT_PRINT_DEFAULT_BUFFERS_COUNTwould be too small in my application, but increasing those values did not make any differences. I ended up looking at the code and got tovprint_to_bufferthat should be called when I want to send an entry to syslog in my RT threads, and was wondering (I believe it is not) whether or not this function was thread safe.
Am I getting something wrong ?
You application is supposed to call rt_syslog (& Co.) or regular syslog when wrapped to map that on the RT version (analogously to other cobalt services). Internally, those are mapped on vprint_to_buffer, true, and that is supposed to be thread-safe - it operates on per-thread data structures and lock-free in a single-producer/single-consumer relationship with the printer thread.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 20 lines · Jan Kiszka
Quoted 12 lines · François Legal
Quoted 10 lines · Jan Kiszka
Quoted 4 lines · François Legal
Hello,
I was wondering whether or not the syslog/vsyslog calls in cobalt runtime libs are thread safe. I observer strange behaviour in my logs under heavy log load.
Can you be more precise in what you do? And which parts of
lib/cobalt/printf.cyou consider problematic /wrt thread safety, the printout to syslog or the wrapper functions themselves?Quoted 6 lines
Quoted 2 lines
Jan
I have a set of threads that would each send to syslof under certain conditions. In my syslog, I can see a bunch of truncated log entries. I'd first though that maybe
RT_PRINT_DEFAULT_BUFFER&RT_PRINT_DEFAULT_BUFFERS_COUNTwould be too small in my application, but increasing those values did not make any differences. I ended up looking at the code and got tovprint_to_bufferthat should be called when I want to send an entry to syslog in my RT threads, and was wondering (I believe it is not) whether or not this function was thread safe.
Am I getting something wrong ?
Quoted 7 lines
You application is supposed to call
rt_syslog(& Co.) or regular syslog when wrapped to map that on the RT version (analogously to other cobalt services). Internally, those are mapped onvprint_to_buffer, true, and that is supposed to be thread-safe - it operates on per-thread data structures and lock-free in a single-producer/single-consumer relationship with the printer thread.
Thanks for the clarification. I misread the pthread_getspecific manual !
So if I understand correctly, my truncated log problem should only be a matter of how large the vprint_to_buffer buffer is, as my non RT log never seem to get truncated. I'll take a look into that.
This code is built in libcobalt, so that the only piece I need to rebuild to enlarge these buffers ? Correct ?
Thanks
François
Quoted 6 lines
Jan
--
Siemens AG, Technology
Linux Expert Center
Quoted 30 lines · François Legal
Quoted 20 lines · Jan Kiszka
Quoted 12 lines · François Legal
Quoted 10 lines · Jan Kiszka
Quoted 4 lines · François Legal
Hello,
I was wondering whether or not the syslog/vsyslog calls in cobalt runtime libs are thread safe. I observer strange behaviour in my logs under heavy log load.
Can you be more precise in what you do? And which parts of
lib/cobalt/printf.cyou consider problematic /wrt thread safety, the printout to syslog or the wrapper functions themselves?Quoted 6 lines
Quoted 2 lines
Jan
I have a set of threads that would each send to syslof under certain conditions. In my syslog, I can see a bunch of truncated log entries. I'd first though that maybe
RT_PRINT_DEFAULT_BUFFER&RT_PRINT_DEFAULT_BUFFERS_COUNTwould be too small in my application, but increasing those values did not make any differences. I ended up looking at the code and got tovprint_to_bufferthat should be called when I want to send an entry to syslog in my RT threads, and was wondering (I believe it is not) whether or not this function was thread safe.
Am I getting something wrong ?Quoted 7 lines
You application is supposed to call
rt_syslog(& Co.) or regular syslog when wrapped to map that on the RT version (analogously to other cobalt services). Internally, those are mapped onvprint_to_buffer, true, and that is supposed to be thread-safe - it operates on per-thread data structures and lock-free in a single-producer/single-consumer relationship with the printer thread.
Quoted 5 lines
Thanks for the clarification. I misread the
pthread_getspecificmanual !
So if I understand correctly, my truncated log problem should only be a matter of how large thevprint_to_bufferbuffer is, as my non RT log never seem to get truncated. I'll take a look into that.
This code is built in libcobalt, so that the only piece I need to rebuild to enlarge these buffers ? Correct ?
You can just call rt_print_init() (rather than relying on implicit initialization) and provide a different buffer size along it.
And if that works, feel free to contribute inline documentation for that function - you had no real fair chance to find that interface :)
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center