Increasing Timeout and resolving Type Mismatch in Data Storage App

I am currently working on an app that should be able to do the following:
It should be able to store data over a user-selected period of time.
- You need to specify the node you want to save.
- You need to specify the mount point of the USB device.
- The period you want (in seconds).
- And the interval at which a value should be saved during that period.

So far, it works quite well, however, I keep getting the following error message in the node:
Method failed - Error: 408
DL_TIMEOUT
original error: DL_TIMEOUT
and
Method failed - Error: 400
DL_TYPE_MISMATCH
Can't read type Information

Despite the error messages, the saving function works, but then the app crashes and has to be restarted.
My specific question is how I can increase the timeout and why I am getting a mismatch error.
Below you will find the important files.

And a few screenshots of what I have already tried:

here you can see the mismatch error

timeout error

but if i chose 2 seconds for period it works

I guees the reason is in node: types/webserver/settings
the default is at 3000 ms, is there a possibilty to change the default?

i also tried to change the value in callable-timeout settings

In the logbook you can see that my code works in manipulating the timeout; it says: Timeout value for the method sdk/usb/history successfully changed at 24000 ms
I tried to set the timeout based on the period and interval

and finally you can see that it somehow worked

Maybe someone with similar problems could help me out. 
Thanks in advance 

 



 

 



 

 

 



Best reply by tiramisu

TY14 ,

I think your problem is that you're answering the request in an synchronous way blocking the provider. So the provider can't send keepalives back to the broker/client. When a client gets no keepalive or answer after 3 seconds it will asume that the request is dead and return a timeout.

A solution is to do it in an asynchronous way:

  • Have a worker thread for doing the "hard" work.
  • In the on...-Method forward the request to the worker thread and return without calling the callback
  • In the worker thread do the work and after finishing call the callback with the result.

So the provider thread is not blocked and can send keepalives back to the client/webserver. You as a implementer of a provider can modify the timeout values:

View original
datalayer.usbsave.zip
6.8KB
4 replies