- **status**: review --> fixed
- **assigned_to**: Vu Minh Nguyen -->  nobody 
- **Comment**:

changeset:   8203:8cda6d0f80fe
tag:         tip
parent:      8200:721e05de1401
user:        Vu Minh Nguyen <vu.m.ngu...@dektech.com.au>
date:        Wed Oct 12 11:25:52 2016 +0700
summary:     log: write_log_record_hdl get bad file descriptor [#2028]

changeset:   8202:8cfed72ed0bd
branch:      opensaf-5.1.x
parent:      8199:a37e89393eea
user:        Vu Minh Nguyen <vu.m.ngu...@dektech.com.au>
date:        Wed Oct 12 11:25:52 2016 +0700
summary:     log: write_log_record_hdl get bad file descriptor [#2028]

changeset:   8201:b94d9e7cbd08
branch:      opensaf-5.0.x
parent:      8198:6f89139a3134
user:        Vu Minh Nguyen <vu.m.ngu...@dektech.com.au>
date:        Wed Oct 12 11:25:52 2016 +0700
summary:     log: write_log_record_hdl get bad file descriptor [#2028]




---

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

**Status:** fixed
**Milestone:** 5.0.2
**Created:** Tue Sep 13, 2016 09:54 AM UTC by Vu Minh Nguyen
**Last Updated:** Tue Sep 20, 2016 05:40 PM UTC
**Owner:** nobody


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.

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.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-tickets mailing list
Opensaf-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to