- **Milestone**: 5.0.1 --> 5.0.2


** [tickets:#2028] log: write_log_record_hdl get bad file descriptor**

**Status:** review
**Milestone:** 5.0.2
**Created:** Tue Sep 13, 2016 09:54 AM UTC by Vu Minh Nguyen
**Last Updated:** Wed Sep 14, 2016 02:37 AM UTC
**Owner:** Vu Minh Nguyen

In current code, logsv passes the `WRITE REQUEST` to the handle thread even the 
file descriptor is invalid.
Here is some code of log_stream_write_h()@lgs_stream.cc
``` C

    if (*stream->p_fd == -1) {
      TRACE("%s - Initiating stream files \"%s\" Failed", __FUNCTION__,
    } else {
      TRACE("%s - stream files initiated", __FUNCTION__);
In that case - `p_fd = -1`, `log_stream_write_h` should inform the client 

Besides, there is an other problem at file closing. Look at the functions 
`fileclose_hdl` and `fileclose_h`.  The file descriptor should be set to 
`invalid` in `fileclose_hdl`,  otherwise `close file` request will re-send to 
the file handle thread even that file is already closed. 

Above cases usually happens when the file sytem is busy.  Extract from syslog:

> 2016-07-02 00:32:48 SC-1 osaflogd[460]: NO fileclose failed Device or 
> resource busy
> 2016-07-02 00:32:50 SC-1 osaflogd[460]: NO fileclose failed Device or 
> resource busy
> 2016-07-02 00:32:52 SC-1 osaflogd[460]: ER write_log_record_hdl - write 
> FAILED: Bad file descriptor


Sent from sourceforge.net because opensaf-tickets@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
Opensaf-tickets mailing list

Reply via email to