Comments (22)
The console log for the server appears as follows at the point of failure. The upper request worked, the lower request did not.
::ffff:67.161.118.40 - - [03/Jan/2017:20:23:37 +0000] "GET /v1/devices/310023000647343432313031/randomSmall?access_token=23ebff850ac11f2ebf20d8683a04a6934ad3f289 HTTP/1.1" 200 13 "-" "curl/7.47.0" GetVar { deviceID: '310023000647343432313031' } ::ffff:67.161.118.40 - - [03/Jan/2017:20:23:38 +0000] "GET /v1/devices/310023000647343432313031/randomSmall?access_token=23ebff850ac11f2ebf20d8683a04a6934ad3f289 HTTP/1.1" 400 58 "-" "curl/7.47.0" GetVar { deviceID: '310023000647343432313031' }
from spark-server.
@wdimmit - thanks, we'll look into this. When I moved the code over I only tested functions and not variables. We should get a fix out by Thursday.
from spark-server.
@jlkalberer For what it's worth, this error state seems to block access to functions as variables once it is triggered.
from spark-server.
One last detail: This happens with function calls as well. Error message is the same. Log snippet of the break between the last good request and the first bad request follows.
`FunCall { deviceID: '1c0036001947343433313339' }
TODO: Type buildArguments
Pinged, replying { deviceID: '1c0036001947343433313339' }
::ffff:67.161.118.40 - - [03/Jan/2017:20:51:47 +0000] "POST /v1/devices/1c0036001947343433313339/arioSet HTTP/1.1" 200 285 "-" "curl/7.47.0"
FunCall { deviceID: '1c0036001947343433313339' }
TODO: Type buildArguments
::ffff:67.161.118.40 - - [03/Jan/2017:20:51:48 +0000] "POST /v1/devices/1c0036001947343433313339/arioSet HTTP/1.1" 400 58 "-" "curl/7.47.0"`
from spark-server.
@AntonPuko - I think this might be the culprit. https://github.com/Brewskey/spark-protocol/blob/master/src/clients/Device.js#L625-L635
I don't think it should reject there. @wdimmit you can validate by turning on showVerboseDeviceLogs
in spark-protocol.
from spark-server.
Setting that flag to true in /src/settings.js had no impact on the console log output. Also tried setting "verboseProtocol: true", but that had no impact either.
from spark-server.
@wdimmit - Is this your test firmware? Do you mind making a gist for @AntonPuko to test with?
from spark-server.
Also, are you doing multiple requests for multiple devices or just a single device?
from spark-server.
I'm doing 1 request / second for a single device, with no other activity against the API. Gist here: https://gist.github.com/wdimmit/0b9a86f5f0ccf212f22fdc51601c3e45
Thanks.
from spark-server.
Ok, one more thing to check. Have you manually removed the spark-protocol
from your spark-server
npm modules and done another install? NPM isn't smart enough to know that a git repo has been updated :/
from spark-server.
hm..can't reproduce anyof your issues:
requests work fine:
and string vars, too:
from spark-server.
I didn't realize that a copy was being cached in node_modules.... My mistake. This voids my observation about those settings variables not changing anything.
This fixes the string variable issue. I'm re-investigating the failure after a number of requests issue.
from spark-server.
@wdimmit - yeah, that's why on our dev machines we are using npm link
and running watchman on the spark-protocol
folder. It makes testing a whole lot easier.
from spark-server.
I'm still seeing the read failure. It often takes several minutes to occur, so 50 iterations will not be sure to trigger it. My last test took roughly 5 minutes to start failing.
I've enabled both the verbosity settings options in spark-protocol (specifically in ./node_modules/spark-protocol/src/settings.js) and I'm still not seeing anything extra in the console surrounding the failure.
from spark-server.
Well, I reproduced your requests issue. seems it something about message's token counter, which at some point becomes bigger than allowed in a device. I'll dig into it tomorrow.
from spark-server.
@AntonPuko Glad you've seen it. If it helps, the magic number seems to be 250 +/- 5. Timing of the requests doesn't seem to matter. Thanks.
from spark-server.
ye, noticed that also. Seems the counter breaks when its more than one byte
from spark-server.
Ahh, that makes sense. It can be fixed here
For tokens it must be less than 256
https://github.com/straccio/spark-protocol/blob/master/clients/SparkCore.js#L547-L570
Here is what it's supposed to be:
https://github.com/straccio/spark-protocol/blob/master/settings.js#L35-L44
This happened because of the large refactor / simplification :/
from spark-server.
Alright, fix is out. I haven't tested as I don't have a device set up but I'm pretty sure we should be good to go after this: Brewskey/spark-protocol@4afd37f
from spark-server.
It appears the previous commit to spark-protocol (pull request 19....) broke something related to variable reads. All queries return the following, and the pull request in question impacted this area of the code:
{
"error": "device.onApiMessage is not a function",
"ok": false
}
from spark-server.
@wdimmit that pr has some breaking changes and intended to be in pair with #60.
@jlkalberer we probably need to make dev
branch in spark-protocol.
btw, just tested, the requests issue is gone with the fix.
from spark-server.
Yeah, makes sense since people are starting to use this. I'll create a branch.
from spark-server.
Related Issues (20)
- .env not working if spark-server is used as dependency HOT 5
- Error on spark-server update-firmware HOT 4
- Response timeout for event: spark-server/call_device_function HOT 5
- ERROR: DeviceServer.js for local server HOT 2
- firmware device counter increases with failed flash attempts HOT 2
- Cannot upload device IDs with non-numeric characters
- Hook for device status change? HOT 3
- Is there a way to pass the contents of the publish event directly to MQ? HOT 7
- Memory Leak
- update-firmware requests failing HOT 3
- support for mesh devices HOT 1
- Function call returns error when firmware function returns zero HOT 6
- Electron session end after every 30 seconds HOT 5
- Throws error on starting spark-server HOT 1
- device names not accepted as deviceId - breaks particle-cli HOT 15
- Device.js/14528 on hostName: Device disconnected (cache_key=_5, deviceID=deviceid, duration=46.791, disconnectCounter=1) HOT 1
- Error with handshake process HOT 32
- Claiming / provisioning a devices without an deviceID HOT 5
- Does this still work? HOT 15
- Is there a renamed implementation of Particle.subscribe(particle/device/name); ? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spark-server.