You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/02 13:35:52 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #4028: syslog: fix log confusion when multi task writing together

xiaoxiang781216 edited a comment on pull request #4028:
URL: https://github.com/apache/incubator-nuttx/pull/4028#issuecomment-872989530


   > Hi @Donny9
   > 
   > I had a look at the changes, but I don't think that this will fix the issue.
   > The problem is not the thread safety of the drivers, rather the multiple calls to `lib_sprintf()`.
   > See #3599.
   
   lib_sprintf format result to lib_syslogstream_s, two cases here:
   
   1. CONFIG_SYSLOG_BUFFER equals y, syslogstream_flush output the log through syslog_write
   2. CONFIG_SYSLOG_BUFFER equals n, syslogstream_addchar output the log through syslog_putc
   
   This patch only address the mess issue in case 1. The lock ensure that the caller of syslog_write don't interlace with each other.
   
   > 
   > Adding a `sc_write()` to all channels seems a good way forward.
   > If `syslog_write_t` is modified to also accept a `force` flag, we can eliminate the `syslog_putc_t` too.
   >
   
   Yes, but sc_putc/sc_force_putc is more simpler to implement than sc_write.
    
   > But I think a semaphore at this place will not solve the actual issue. Depending on the solution to the initial problem, it may not be needed at all.
   > 
   > Do you have any plans for further development on this?
   > (I have also spent quite some time thinking about this and experimenting, but I haven't reached a "good" final implementation...)
   
   Case 1 should be addressed by:
   
   1. syslog driver self(e.g. ramlog, devlog), if it provide the multithread safe sc_write
   2. syslog_default_write with this patch
   
   But, it's impossible to fix case 2.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org