Re: NullPointerException
Wes Stupar <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
Recent results of test and debug:
In the system in question, the Monitor reads status values
like temperature etc., and saves the values. One or more
separate threads access and display the values. It is an
unusual producer-consumer arrangement since the consumer
doesn't care whether it gets the previous value or the
current value. It doesn't care if it misses a value if a
value is not being asked for. It just wants the latest
information it can get when it wants it.
Some of the status information is pass-by-reference, arrays
or strings or other classes. I think the pass-by-value
things were OK, but apparently in the process of updating a
pass-by-reference variable, the consumer can end up with a
null pointer. In any case, I was able to redefine small
arrays as the individual elements, and I made classes with
wait/notify protection for larger classes, and this
eliminated the null pointer exceptions--almost.
I am still getting an occasional null pointer exception,
apparently down in the OS. I wonder if there is some
synchronization missing there... I can't explain the
following stack dump any other way:
java.lang.NullPointerException
java.lang.System.arraycopy(a0007)
com.dalsemi.onewire.adapter.TINIAdapter.select(400021)
com.dalsemi.onewire.container.OneWireContainer26.readPage(230032)
com.dalsemi.onewire.container.OneWireContainer26.readDevice(46000f)
com.iQstor.esp2r12.OneWire.readTemp(1f0018)
com.iQstor.esp2r12.Monitor.run(220180)
java.lang.Thread.run(22001a)
java.lang.NullPointerException
in com.iQstor.esp2r12.TCPCom.run(@JPC=220046)
in java.lang.Thread.run(@JPC=22001a)
Wes Stupar
Wes Stupar wrote:
I am running TINI1.12. Since posting this message I found some
synchronization errors in the program. Monitor is a producer
of status
information. Method sendR1200InfoMessage gets called to use
that status
information. There is another thread that can also invoke
sendR1200InfoMessage asynchronously. I wonder if the
NullPointerException can be caused by this error.
Bryan Armstrong wrote:
> Wes Stupar wrote:
>
>> My TINI400 program has a nasty bug that causes the
>> NullPointerException. Here is an example of the stack trace:
>> java.lang.NullPointerException
>> in com.iqstor.IQcom.unitInformationMessage.<init>(@JPC=43)
>> in
com.iqstor.IQcom.r1200InformationBroadcastMessage.<init>(@JPC=2)
>> in
com.iQstor.esp2r12.UDPCom.sendR1200InfoMessage(@JPC=35003a)
>> in com.iQstor.esp2r12.Monitor.run(@JPC=22029a)
>> in java.lang.Thread.run(@JPC=22001a)
>> in com.iQstor.esp2r12.TCPCom.run(@JPC=
>> Can someone help me interpret this trace? It was truncated,
>> presumeably due to the crash. It seems to have been in
the TCPCom
>> thread (there are 6 threads running plus slush) and the
Monitor
>> thread. Is this a normal trace, to show two threads?
Does the <init>
>> mean that it is in the constructor of the class? The class
>> r1200InformationBroadcastMessage extends
unitInformationMessage.
>>
>> I have not been able to spot a place in the constructor for
>> unitInformationMessage that could give rise to a null
pointer. Any
>> ideas would be appreciated.
>
>
> This looks like a dump from the Monitor thread, see the
run() method.
> Then, the function sendR1200InfoMessage was called. Then
two
> constructors were called.
>
> What TINI version are you using?
>
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini