Hi everyone!

I've just found a bug in processing wp callbackId. When I'm trying to 
"cordova.exec" my own http client plugin several times, all requests after the 
first one fail with a message: "Failed to locate callback for id : XXXXX"

After some investigation I've came to conclusion that CommandFactory returns 
the same instance for those requests. And this instance of BaseCommmand stores 
callbackId into this.CurrentCommandCallbackId. So, if we have 5 simultaneous 
requests, only the last callbackId is used.

For now, I'm using DispatchCommandResult (result, unmodifiedCallbackId) and 
everything is working fine. DispatchCommandResult (result) is broken for 
simultaneous async plugin calls for the same plugin/method.

I cannot share code this time, but you can see the log below.

[107648>599025] HTTPClient.run (1) started
cordova.js exec    >>> callbackId is: HTTPClient217411808
CordovaCommandCall >>> CommandString : 
HTTPClient/request/HTTPClient217411808/["http://192.168.0.1/api/monitoring/status";]
NativeExecution    >>> HTTPClient217411808
[107648>816581] HTTPClient.run (1) started
cordova.js exec    >>> callbackId is: HTTPClient217411809
CordovaCommandCall >>> CommandString : 
HTTPClient/request/HTTPClient217411809/["http://192.168.0.1/api/monitoring/traffic-statistics";]
NativeExecution    >>> HTTPClient217411809
[107648>519782] HTTPClient.run (1) started
cordova.js exec    >>> callbackId is: HTTPClient217411810
CordovaCommandCall >>> CommandString : 
HTTPClient/request/HTTPClient217411810/["http://192.168.0.1/api/device/information";]
NativeExecution    >>> HTTPClient217411810
[107648>994073] HTTPClient.run (1) started
cordova.js exec    >>> callbackId is: HTTPClient217411811
CordovaCommandCall >>> CommandString : 
HTTPClient/request/HTTPClient217411811/["http://192.168.0.1/api/sms/sms-count";]
NativeExecution    >>> HTTPClient217411811
[107648>516070] HTTPClient.run (1) started
cordova.js exec    >>> callbackId is: HTTPClient217411812
CordovaCommandCall >>> CommandString : 
HTTPClient/request/HTTPClient217411812/["http://192.168.0.1/api/net/current-plmn";]
NativeExecution    >>> HTTPClient217411812
[019830] workflow complete in 930ms
The thread 0xc94 has exited with code 259 (0x103).
The thread 0xbc8 has exited with code 259 (0x103).
The thread 0xd6c has exited with code 259 (0x103).
The thread 0xa84 has exited with code 259 (0x103).
The thread 0xbb4 has exited with code 259 (0x103).
HTTPClientPlugin >>> stored callbackId: HTTPClient217411808
HTTPClientPlugin >>> stored callbackId: HTTPClient217411809
BaseCommand      >>> Failed to locate callback for id : HTTPClient217411812
[107648>516070] HTTPClient.run (4) task completed
[107648>516070] parsePage (1) started
[107648>516070] parsePage (4) task completed
have completed tasks
[107648>516070] workflow complete in 501ms
HTTPClientPlugin >>> stored callbackId: HTTPClient217411811
BaseCommand      >>> Failed to locate callback for id : HTTPClient217411812
HTTPClientPlugin >>> stored callbackId: HTTPClient217411810
BaseCommand      >>> Failed to locate callback for id : HTTPClient217411812
HTTPClientPlugin >>> stored callbackId: HTTPClient217411812
BaseCommand      >>> Failed to locate callback for id : HTTPClient217411812

Reply via email to