GithubHelp home page GithubHelp logo

Comments (22)

wdimmit avatar wdimmit commented on August 16, 2024

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.

jlkalberer avatar jlkalberer commented on August 16, 2024

@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.

wdimmit avatar wdimmit commented on August 16, 2024

@jlkalberer For what it's worth, this error state seems to block access to functions as variables once it is triggered.

from spark-server.

wdimmit avatar wdimmit commented on August 16, 2024

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.

jlkalberer avatar jlkalberer commented on August 16, 2024

@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.

wdimmit avatar wdimmit commented on August 16, 2024

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.

jlkalberer avatar jlkalberer commented on August 16, 2024

@wdimmit - Is this your test firmware? Do you mind making a gist for @AntonPuko to test with?

from spark-server.

jlkalberer avatar jlkalberer commented on August 16, 2024

Also, are you doing multiple requests for multiple devices or just a single device?

from spark-server.

wdimmit avatar wdimmit commented on August 16, 2024

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.

jlkalberer avatar jlkalberer commented on August 16, 2024

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.

AntonPuko avatar AntonPuko commented on August 16, 2024

hm..can't reproduce anyof your issues:
requests work fine:
varrequests
and string vars, too:
123strings

from spark-server.

wdimmit avatar wdimmit commented on August 16, 2024

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.

jlkalberer avatar jlkalberer commented on August 16, 2024

@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.

wdimmit avatar wdimmit commented on August 16, 2024

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.

AntonPuko avatar AntonPuko commented on August 16, 2024

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.

wdimmit avatar wdimmit commented on August 16, 2024

@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.

AntonPuko avatar AntonPuko commented on August 16, 2024

ye, noticed that also. Seems the counter breaks when its more than one byte

from spark-server.

jlkalberer avatar jlkalberer commented on August 16, 2024

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.

jlkalberer avatar jlkalberer commented on August 16, 2024

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.

wdimmit avatar wdimmit commented on August 16, 2024

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.

AntonPuko avatar AntonPuko commented on August 16, 2024

@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.

jlkalberer avatar jlkalberer commented on August 16, 2024

Yeah, makes sense since people are starting to use this. I'll create a branch.

from spark-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.