Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks Not Disappearing #67

Open
ksinghal opened this issue May 26, 2016 · 15 comments
Open

Tasks Not Disappearing #67

ksinghal opened this issue May 26, 2016 · 15 comments

Comments

@ksinghal
Copy link

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
screen shot 2016-05-26 at 7 24 19 am

@ksinghal
Copy link
Author

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: #48 (comment)

I am unable to resolve tasks async, only sync.

@katowulf
Copy link

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

@katowulf
Copy link

katowulf commented May 26, 2016

Also, hi!! Welcome! ☃☃☃

@ksinghal
Copy link
Author

ksinghal commented May 26, 2016

  • Edited to remove extraneous ExpressJS code from repro.
  • Edited for typos and removed my personal Firebase URL.

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:
screen shot 2016-05-26 at 1 10 11 pm
screen shot 2016-05-26 at 1 10 21 pm

@cbraynor
Copy link
Contributor

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?

@ksinghal
Copy link
Author

ksinghal commented May 28, 2016

  • Edited to include code that adds tasks to the queue

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

screen shot 2016-05-28 at 4 02 16 pm

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)
            }
        }
    }
}

@ksinghal
Copy link
Author

ksinghal commented Jun 9, 2016

Hi, I was wondering if you needed any more information on my end to get to the bottom of this issue?

@gvkhna
Copy link

gvkhna commented Jul 12, 2016

+1

1 similar comment
@amartone
Copy link

+1

@ksinghal
Copy link
Author

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

@ksinghal
Copy link
Author

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

@prescottprue
Copy link

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

@ksinghal
Copy link
Author

I simply restarted the server locally, without redeploying and without running "npm install"

@ksinghal
Copy link
Author

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

@katowulf
Copy link

Possibly related to #48.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants