[Openais] RE: Library core dump using evt.

Mark Haverkamp markh at osdl.org
Wed Jan 11 07:42:42 PST 2006


On Wed, 2006-01-11 at 07:21 -0800, Mark Haverkamp wrote:
> On Tue, 2006-01-10 at 17:19 -0700, Steven Dake wrote:
> > Mark,
> > 
> > The patches generally look good, except for the SA_AIS_ERR_LIBRARY
> > return codes.  I've very loath to use them if we don't have to.  Are
> > they absolutely necessary?
> I know,  but the specification doesn't say that SA_AIS_ERR_NO_MEMORY is
> an expected return code.  How do you read the "Return Values" of the
> spec?  Do they mean "These are the only returns codes that you will get"
> or is it possible to get other ones?  Anyway, out of the codes specified
> in the document it seemed the only one to fit. The others seemed pretty
> specific to a particular problem.
> 
> Mark.

[...]

> > > 1) This fixes the handle leak on failure, the malloc check for hl and
> > > removes the redundant memset when creating a handle.
> > > 
> > > 2) Check malloc return and handle destroying and freeing the event on
> > > failure.  The event destructor will handle freeing any already allocated
> > > memory.  This is called by saEvtDispatch which doesn't return
> > > SA_AIS_ERR_NO_MEMORY, so I am returning SA_AIS_ERR_LIBRARY.

Just to add some more data here are the possible return codes for saEvtDispatch:

SA_AIS_OK - The function completed successfully.

SA_AIS_ERR_LIBRARY - An unexpected problem occurred in the library (such as
corruption). The library cannot be used anymore.

SA_AIS_ERR_TIMEOUT - An implementation-dependent timeout occurred before
the call could complete. It is unspecified whether the call succeeded or whether it
didn’t.

SA_AIS_ERR_TRY_AGAIN - The service cannot be provided at this time. The 
process may retry later.

SA_AIS_ERR_BAD_HANDLE - The handle evtHandle is invalid, since it is corrupted,
uninitialized, or has already been finalized.

SA_AIS_ERR_INVALID_PARAM - The dispatchFlags parameter is invalid.

I had considered SA_AIS_ERR_TRY_AGAIN, but I don't have a good way to
save the event.  The data that I read from the exec is on the stack and
since I can't allocate memory to save it, I'm kind of stuck.  So
SA_AIS_ERR_LIBRARY may be OK here anyway since we've now lost an event
and the application can't be told about it.

> > > 
> > > 3) Check malloc return on hl data structures.
> > > 
> > > 4) Check malloc return and back out previous mallocs before returning an
> > > error.  Since saEvtEventAttributesGet doesn't return
> > > SA_AIS_ERR_NO_MEMORY, I return SA_AIS_ERR_LIBRARY.

SaEvtEventAttributesGet returns these:

SA_AIS_OK - The function completed successfully.                                                                                             1

SA_AIS_ERR_LIBRARY - An unexpected problem occurred in the library (such as
corruption). The library cannot be used anymore.

SA_AIS_ERR_TIMEOUT - An implementation-dependent timeout occurred before
the call could complete. It is unspecified whether the call succeeded or whether it
didn’t.

SA_AIS_ERR_TRY_AGAIN - The service cannot be provided at this time. 
The process may retry later.

SA_AIS_ERR_BAD_HANDLE - The handle eventHandle is invalid, due to one or
more of the reasons below:
  • It is corrupted, was not obtained via the saEvtEventAllocate() or
     saEvtEventDeliverCallback() functions, or saEvtEventFree() has already been
     invoked for eventHandle.
  • The corresponding event channel has already been closed.
  • The handle evtHandle that was passed to the saEvtChannelOpen() or
     saEvtChannelOpenAsync() functions has already been finalized.

SA_AIS_ERR_INVALID_PARAM - A parameter is not set correctly.

SA_AIS_ERR_NO_SPACE - The field allocatedNumber in patternArray is smaller
than the number of event patterns or the size of the buffer allocated for one of the pat-
terns is smaller than the actual size of the pattern. This return value applies only if the
patterns field in patternArray as an in parameter is not NULL.

This one I suppose SA_AIS_ERR_TRY_AGAIN would be OK.  Since no
information is lost and it might work again later, maybe.


-- 
Mark Haverkamp <markh at osdl.org>




More information about the Openais mailing list