FirebaseExtended / firebase-queue

MIT License
786 stars 108 forks source link

Queue dies or doesn't process all tasks when using Node 0.11.x #22

Closed phulst closed 9 years ago

phulst commented 9 years ago

Hi there,

so far I've been unable to get even the most basic of queue working properly: see the following (coffeescript) code:

Firebase = require 'Firebase'
Queue = require 'firebase-queue'

ref = new Firebase("https://myhost.firebaseio.com/testQueue")

# set up queue and listen for messages
queue = new Queue ref, (data, progress, resolve, reject) ->
  console.log "packet on queue: "
  console.dir data
  resolve()

# post 10 messages to the queue
for num in [1..10]
  ref.child('tasks').push({ msg: 'this is message ' + num })
  console.log 'added message ' + num

this usually outputs the following:

added message 1
added message 2
added message 3
added message 4
added message 5
added message 6
added message 7
added message 8
added message 9
added message 10
packet on queue:
{ msg: 'this is message 1' }
packet on queue:
{ msg: 'this is message 3' }
packet on queue:
{ msg: 'this is message 4' }
packet on queue:
{ msg: 'this is message 5' }
packet on queue:
{ msg: 'this is message 6' }
packet on queue:
{ msg: 'this is message 7' }
done.

yes, it usually skips message 2 and typically leaves 4-6 messages on the queue that it never picks up. Am I missing something here or is this library plain broken? thanks Peter

phulst commented 9 years ago

Also, how can I turn on the debug logging externally, for these classes?

cbraynor commented 9 years ago

This was also sent to support@ for help there, and we're working on being able to reproduce the issue (currently we can't)

To answer your second question, this is how you enable debug logging on the queue:

var winston = require('winston');
winston.level = 'debug';
cbraynor commented 9 years ago

So it looks like this is related to the version of Node you're running. TL;DR use a stable version of Node (don't use 0.11.x)

Node 0.10.x and 0.12.x stable releases work, but some versions of 0.11.x are based off a version of V8 with a broken SHA hash implementation which breaks Firebase transactions. Upgrading 10 0.12.4, downgrading to 0.10.38 or using io.js should all fix the problem.

phulst commented 9 years ago

that did it. thanks for the help in tracking this down!

dreadjr commented 9 years ago

I am seeing similar behavior, leaving tasks in finished state, and next state is not activated. Restarting the process start processing again. Still trying to debug into it.