[NeXus-code-tickets] [NeXusCode] #219: napi error reporting not thread safe

NeXus Data Format Library and Applications noreply at nexusformat.org
Tue Sep 18 10:52:28 BST 2012


#219: napi error reporting not thread safe
-----------------------------+------------------------
  Reporter:  Tobias Richter  |      Owner:  Unassigned
      Type:  defect          |     Status:  closed
  Priority:  major           |  Milestone:
 Component:  napi            |    Version:  4.2.0
Resolution:  fixed           |   Keywords:
-----------------------------+------------------------
Changes (by Freddie Akeroyd):

 * status:  new => closed
 * resolution:   => fixed


Old description:

> NXIReportError and NXpData are held as global variables in napi.c. So
> changing the error reporting (NXMSetError) in one thread affects all
> threads.
>
> We see occasional crashes of the JVM. The Java binding stores thread
> information in NXpData. If that is overwritten in another thread and an
> error occurs in the first thread the JNI code tries to throw an exception
> in the wrong thread. At least I think this is what is happening. Now that
> I have come up with that theory I can more easily test it.
>
> But I am pretty sure the implementation is broken (for all bindings using
> napi.c).
> Please correct me if I am wrong.

New description:

 NXIReportError and NXpData are held as global variables in napi.c. So
 changing the error reporting (NXMSetError) in one thread affects all
 threads.

 We see occasional crashes of the JVM. The Java binding stores thread
 information in NXpData. If that is overwritten in another thread and an
 error occurs in the first thread the JNI code tries to throw an exception
 in the wrong thread. At least I think this is what is happening. Now that
 I have come up with that theory I can more easily test it.

 But I am pretty sure the implementation is broken (for all bindings using
 napi.c).
 Please correct me if I am wrong.

--

-- 
Ticket URL: <http://trac.nexusformat.org/code/ticket/219#comment:13>
NeXus Data Format Library and Applications <http://www.nexusformat.org/>
NeXus Data Format Library and Applications



More information about the NeXus-code-tickets mailing list