Primary reason I see to happen this scenario was, the 'fd(s)' were not handled 
properly with in the process execution flow.

Chances of happening: 
When the `fd` is made to close twice in a particular flow viz., after 
reallocating the closed 'fd' for some other usage, again this 'fd' is made to 
close by the initial flow. 

Similar behavior was explained in ticket# 147.

Yes, in this situation better to call osaf_abort() to generate a core-dump.



---

** [tickets:#928] base: Selection object fails due to re-cycled file 
descriptor**

**Status:** unassigned
**Milestone:** 4.3.3
**Created:** Wed May 28, 2014 07:48 AM UTC by Anders Widell
**Last Updated:** Wed May 28, 2014 07:48 AM UTC
**Owner:** nobody

A case has been seen where syslog gets filled with thousands of messages like 
the one below:

    May 3 15:37:48 SC-1 osaflogd[7643]: ncs_sel_obj_rmv_ind: recv failed - 
Socket operation on non-socket

Probably the wrong file descriptor is being used here when this happens. When 
looking at the code, there are some obvious improvements that can be made:

* Whenever the file descriptors raise_obj and/or rmv_obj are closed, the file 
descriptors in the data structure should be overwritten with -1 to indicate 
that the file descriptor is no longer valid. Relying on subsequent system calls 
to fail with EBADF is not a good idea, since the file descriptor may be 
re-cycled. This might be what has happened in the syslog entry above.
* The function ncs_sel_obj_rmv_ind() should check if either file descriptor is 
less than zero, and if so, return immediately without trying to operate on the 
file descriptors. It may log to syslog in this case, but in order to avoid 
spamming the log it should make sure to log only once. This can be achieved by 
e.g. logging if the file descriptor is -1, and then change it to -2 so that the 
next call will not log to syslog.
* If, after implementing the changes suggested above, recv() still fails due to 
any other reason than EAGAIN, EWOULDBLOCK or EINTR, we should call osaf_abort() 
to generate a core dump. Errors like "socket operation on non-socket" is an 
indication of a bug.



---

Sent from sourceforge.net because [email protected] 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.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to