---

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

**Status:** accepted
**Milestone:** 5.0.1
**Created:** Tue Sep 13, 2016 09:54 AM UTC by Vu Minh Nguyen
**Last Updated:** Tue Sep 13, 2016 09:54 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
    log_initiate_stream_files(stream);

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

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.  Osaflogd TRACE:

> 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
Opensaf-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to