Open ksinghal opened 8 years ago
I don't think this is the same as #48, because I do not have any indexes in my firebase. However, my problem is exactly the sync vs async issue described in this comment: https://github.com/firebase/firebase-queue/issues/48#issuecomment-208400101
I am unable to resolve tasks async, only sync.
Please provide a minimal repro and also sample data including what the task event looks like at each point in the process (not just the spec).
Also, hi!! Welcome! ☃☃☃
Hi Katowulf, thank you for your prompt response! Here is an example of server side NodeJS code that reproduces this issue. I am using node v5.5.0
, and using firebase 2.4.2
, and have tried using firebase-queue 1.3.0
, 1.3.1
, and 1.4.0
var Queue = require('firebase-queue'), Firebase = require('firebase');
var ref = new Firebase(***FIREBASE_URL***);
var queue = new Queue(ref.child('queues').child('create_reservation'), {'numWorkers' : 1, 'specId' : 'default_spec'}, function(data, progress, resolve, reject) {
setTimeout(function() { resolve(data); }, 3000);
});
The task goes between the two states in the attached images:
Could you include your specs and share some of the code that adds onto the queue. Also, is the express stuff important to the repro?
Here is an image of an example spec that exhibits the behavior described. The tasks are attached to the queue, the spec worker processes them, and finally the _state
, _progress
, and _owner
are removed and then added again. The single spec worker in the image keeps running each task over and over again and i have never seen it stop so I assume it's infinite
I have also updated my comment above to remove the unnecessary ExpressJS code
Here is the iOS client code I am using to push tasks. I call this function with the variables included in the previous comment (but it doesn't matter whether I add my own information to the task or just push an "empty" task)
public func performTask(queue: String, data: [String : AnyObject], completion: (success: Bool) -> Void) {
queueRef.child(queue).child("tasks").push(data) { error, ref in
if error != nil { completion(success: false); return }
queueRef.child(queue).child("tasks").child(ref.key).once(.Value) { snapshot in
guard snapshot.exists() else {
completion(success: true)
return
}
queueRef.child(queue).child("tasks").queryOrderedByKey().queryEqualToValue(ref.key).once(.ChildRemoved) { snapshot in
completion(success: true)
}
}
}
}
Hi, I was wondering if you needed any more information on my end to get to the bottom of this issue?
+1
+1
Hello Firebase Team,
This issue had resolved itself for a period of a month or so, after upgrading to firebase 3.x and the new firebase queue. Now after 3 and a half months of it working properly with asynchronous resolves, and with zero code changes on my end it has reappeared today unexpectedly. I am fairly frustrated and confused as I am not sure what is leading to this issue. It seems to pop up unexpectedly and not due to changes on my end
UPDATE:
Now I am getting worried, because after popping up for a period of 2 hours, the issue resolved itself again with no modification of my system's code. As I am hoping to put my applications into production soon, I really do not want to risk a re-ocurrence of this issue without a known cause or way to mitigate it. Thank you again for your continued support, I look forward to hearing back
@ksinghal Kinda a long shot question here, but did you redeploy your code at all? If it was reinstalled without a specific enough (using ^
) package.json file you might be getting a different version of firebase
or another dependency then you had before. I had this happen when changing absolutely 0 code and pushing just for a change in a README.
Example:
Your package file has something like ^3.0.0
and everything was working before on 3, as soon as a patch is released and you reinstall you will be on that changed version (maybe 3.0.1).
I simply restarted the server locally, without redeploying and without running "npm install"
to clarify, I restarted the server many times without making modifications, and the issue was still present. Then, all of a sudden after a few hours the issue just seemed to stop happenning
Possibly related to #48.
I am calling the resolve function, but the task seems to be reclaimed instantly by the worker even after it has already been completed. In other words, the tasks never complete - they keep happening over and over infinitely... I have added a screenshot of my spec if that helps