eclipse-californium / californium

CoAP/DTLS Java Implementation
https://www.eclipse.org/californium/
Other
728 stars 364 forks source link

MID must be a 16 bit unsigned int: -1 #2075

Closed zhuocongbin6 closed 1 year ago

zhuocongbin6 commented 2 years ago

Protocol stage thread got exception :{} java.lang.IllegalArgumentException: MID must be a 16 bit unsigned int: -1 at org.eclipse.californium.core.network.Exchange$KeyMID.(Exchange.java:568) ~[nbiot-acc-4.0.0-20211201.jar:?] at org.eclipse.californium.core.network.Exchange$KeyMID.fromOutboundMessage(Exchange.java:639) ~[nbiot-acc-4.0.0-20211201.jar:?] at org.eclipse.californium.core.network.UdpMatcher.receiveResponse(UdpMatcher.java:376) ~[nbiot-acc-4.0.0-20211201.jar:?] at com.heclouds.nbiot.component.core.coap.endpoint.NbiotRawDataChannel.receiveResponse(NbiotRawDataChannel.java:256) ~[nbiot-acc-4.0.0-20211201.jar:?] at com.heclouds.nbiot.component.core.coap.endpoint.NbiotRawDataChannel.receiveMessage(NbiotRawDataChannel.java:164) ~[nbiot-acc-4.0.0-20211201.jar:?] at com.heclouds.nbiot.component.core.coap.endpoint.NbiotRawDataChannel.lambda$receiveData$0(NbiotRawDataChannel.java:139) ~[nbiot-acc-4.0.0-20211201.jar:?] at com.heclouds.nbiot.component.core.coap.endpoint.NbiotCoapEndpoint.lambda$runInProtocolStage$3(NbiotCoapEndpoint.java:400) ~[nbiot-acc-4.0.0-20211201.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_77] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_77] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_77] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_77] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_77] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_77] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_77]

version is 1.1.x

running about 2mouth, occurs the error, please help me, thinks!

boaks commented 2 years ago

version is 1.1.x

Did you had a look at Security Policy?

Version 1.1.x was abandoned years ago. I have no glue, why some choose that stale version. I don't know, if that's a bug in that version or if that is caused by sending too much messages.

Please update/migrate to version 3.7.0 and retest it with that.

zhuocongbin6 commented 2 years ago

how to set MAX_PEER_INACTIVITY_PERIOD, based on experience

boaks commented 2 years ago

Either in the Californium.properties (editing) or using the Configuration API before starting the endpoints. (The Configuration API has changed, but the abandoned branch may contain some javadoc.)

From many, many other cases: Feel free to try, if you can fix it. Hope that you're successful. The most have failed and just wasted their time. For any future perspective, an update to 3.7.0 is from my point of view mandatory.

boaks commented 1 year ago

Did it help?

I simply only recommend, update to 3.7.0.

do you have further questions? Otherwise, can we close this issue?

boaks commented 1 year ago

Don't hesitate to add new comments or open a new issue, if you have updates.