-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solved the CryptoStream errors causing the node version incompatibili… #14
Conversation
…ties, now works with up to node 12.5
awesome, thank you for the PR! If you haven't already could you sign our CLA? https://docs.google.com/a/spark.io/forms/d/1_2P-vRKGUFg5bmpcKLHO_qNZWGi5HKYnfrrkd-sbZoA/viewform |
after re-doing npm install, this change worked for me on 12.5. Thanks! |
@schwiet Awesome thanks for checking |
fwiw, I also just had a chance to test this with node v5.0. works! |
@PseudoSky a million thanks for this; I can confirm that the fix also works with node v4.2.6 LTS; I did an in-place upgrade from 0.10.41. EDIT: unfortunately, using node v4.2.6 LTS still presents issues re: the NULL CoAP message, as described in particle-iot/spark-server#69. Devices are able to connect, but disconnect briefly after publishing an event, causing a 1-second lag as it restores connection to the local cloud. https://community.particle.io/t/node-js-version-and-spark-server/10387/6 |
merge @straccio's fixes for event subscription (particle-iot#12) which includes @PseudoSky's CryptoStream fix (particle-iot#14)
thank you ! it worked for me! |
Not sure if this library has just been abandoned. But would really appreciate if this fix could get pulled in. Just ran into it again and had to search for this patch again. Love using my particle devices locally, please don't let this die! |
Issues@PseudoSky @schwiet I am wondering whether you can get spark-server on V4 node works perfectly. I am currently doing project involved with particle local cloud but on V4 node. After following previous discussions, most of issues can be solved except the CryptoStream transform error, where the prompt information said:
This error is not continuous popped out, which may be ok to ignore for low resolution work. However, it can be fatal for high resolution data acquisition due to the broken pipe because of this. Any suggestions will be appreciated! some updatesAfter looking into code, I believe the exception occurs in following code snippet in CryptoStream.js file
|
@chenchenece fwiw, I am using spark-protocol with node v4 on a Synology box and not seeing the error with this patch applied. |
@schwiet Yest, actually it did work, but only for small data low frequency. |
@chenchenece - did you ever end up figuring this out? I'm pretty sure this bug still exists in Brewskey/spark-protocol |
@jlkalberer - hey, it turns out the issues are not originated from server side, it is on the firmware side, but we can only mask the error on the server size. This means that the packets received at the server side are corrupted and surely it makes sense why they cannot be decrypted. At the firmware side, if you go deep into system hal part, you will find that a system call named wiced_tcp_send_buffer(). The interesting thing is that, if packets are transmitted at high rate, the socket stream becomes full. However in this case, this function will still send the data chunk that is written into stream which however is only part of packet. The result is that the server will receive this corrupted packets which surely cannot be decrypted. So as a short summary, I will say the fundamental issues are the broadcom wice library. @schwiet i tried same code using node 4 and node 6 as well. I will say the problem will eventually occurred if you increase packet rate until the point when socket stream is full. You will find sometimes only part of corrupted data are transmitted to server, which will cause these errors (bad decrypted/CoAP etc.) |
fix wrong returning value in fromBinary().
Primarily in reference to spark-protocols use in spark-server
There seems to have been an issue with the Crypto Stream library that lead to node version incompatibilities.
The crypto stream error was coming from the additional null packet before the end of the stream
Debugging the stream:
Wrapping the cipher text chunk concatenation statement with a check for null chunks seems to solve (I believe) all of the node version dependency issues.