lwm2m-node-lib
lwm2m-node-lib copied to clipboard
Error: Write after end
I found an error when I tried to run my client lwm2m. My client sends 200 request any 2 seconds and after 125 requests I have this error: Tried to write to a closed stream. and I print the error in the console: write after end I'm using node 10.15.0 and npm 6.4.1. I attached my test client and my provisioning for IoT Agent. provisioning.zip test.zip
Not sure what the cause of the problem can be, but recently @versatildefuy and @dherykw has been working on this libreary. Maybe they can help.
I think I solved this error using "lwm2m-node-lib": "1.0.0"
in the package.json of lightweightm2m-iotagent instead of the last version (default it was 1.2.0).
Versions 1.1.0 and 1.2.0 always provided me the "write after end" error.
Hello @pasquy73 ,
Happy to see you arround. I guess the client you're developing is based on the examples that come with the repository.
Hi @dherykw, I used/created that client provided in the library to test the LWM2M version 0.4.0 in the QA task. When I used the new version of LWM2M I found that error using the same client. I also provided my zip files, if you want to repeat the test and understand the issue.
I would try with the release/1.3.0
Let me know with the 1.3.0, and please try to use my client to send multiple requests any x
seconds
I know that the examples in the v1.3.0 work fine with some minor bugs, but I am almost sure that you can use them to follow the tutorial.
I can't help you beyond that because we don't use this library we just fix the server issues for the compatibility of our devices. I should do the tutorial also :laughing:
if you wanted the lwM2M client for functional testing I would suggest to you to use our LwM2M virtual device, it is dockerized and documented here feel free to use it :rocket:
I think I solved this error using
"lwm2m-node-lib": "1.0.0"
in the package.json of lightweightm2m-iotagent instead of the last version (default it was 1.2.0). Versions 1.1.0 and 1.2.0 always provided me the "write after end" error.
That means that the issue was introduced in the 1.0.0 to 1.1.0 step. Here are the difference between both it isn't very useful (too long and complex). Maybe more interesting in the changelog between both versions (https://github.com/telefonicaid/lwm2m-node-lib/releases/tag/1.1.0):
Changes (since 1.0.0):
- Set Nodejs 6.14.4 as minimum version in packages.json (effectively removing Nodev4 as supported version)
- Add: npm scripts to execute tests, coverage, watch and clean
- Fix: Active attributes not working since coap proxy is not being used for lwm2m observations so observations arrives to the device from a different port from the used in the rest of communications (#110)
- Fix: Avoid faster libcoap response: libcoap is not waiting long enough for lightweight-iotagent and lwm2m-node-lib to send the response (#104)
- Fix: cannot handle update registration from a Wakaama client (#106)
- Replace mongoose-auto-increment dependency (unmantained) with mongoose-plugin-autoinc
- Upgrade: async dependence from 1.5.2 to 2.6.1
- Upgrade: coap dependence from 0.17.0 to 0.22.0
- Upgrade: coap-cli dependence from 0.4.0 to 0.5.1
- Upgrade: mongodb dependence from 2.1.7 to 3.1.9
- Upgrade: mongoose dependence from 4.4.3 to 5.3.10
- Upgrade: logops dependence from 0.5.0 to 2.1.0
- Upgrade: underscore dependence from 1.7.0 to 1.9.1
- Upgrade: mocha development dependence from 2.4.5 to 5.2.0
- Upgrade: should development dependece from 8.2.2 to 13.2.3
- Upgrade: istanbul development dependence from ~0.1.34 to ~0.4.5
- Upgrade: proxyquire development dependence from 0.5.1 to 2.1.0
- Ensure precise dependencies (~=) are used in packages.json
- Remove: old unused development dependencies (closure-linter-wrapper, sinon-chai, sinon, chai, grunt and grunt related modules)
I hope this information can help to find the problem.