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

BSON::InvalidDocument exception #32

Closed
fbjork opened this issue Oct 26, 2011 · 3 comments
Closed

BSON::InvalidDocument exception #32

fbjork opened this issue Oct 26, 2011 · 3 comments

Comments

@fbjork
Copy link

fbjork commented Oct 26, 2011

Getting an exception when I run the following:

options = { generated_at: Time.current, meta: { state: :processed, source: 'Chat', client: 'iPhone' } }
Qu.enqueue(StatsWorker, "Push Notifications", 1, options)

Stack trace:
BSON::InvalidDocument exception raised:

/app/vendor/bundle/ruby/1.9.1/gems/bson-1.3.1/lib/bson/bson_c.rb:24:in `serialize'
/app/vendor/bundle/ruby/1.9.1/gems/bson-1.3.1/lib/bson/bson_c.rb:24:in `serialize'
/app/vendor/bundle/ruby/1.9.1/gems/mongo-1.3.1/lib/mongo/collection.rb:872:in `block in insert_documents'
/app/vendor/bundle/ruby/1.9.1/gems/mongo-1.3.1/lib/mongo/collection.rb:871:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/mongo-1.3.1/lib/mongo/collection.rb:871:in `insert_documents'
/app/vendor/bundle/ruby/1.9.1/gems/mongo-1.3.1/lib/mongo/collection.rb:305:in `insert'
/app/vendor/bundle/ruby/1.9.1/gems/qu-mongo-0.1.3/lib/qu/backend/mongo.rb:55:in `enqueue'
/app/vendor/bundle/ruby/1.9.1/gems/qu-0.1.3/lib/qu.rb:29:in `enqueue'
/app/app/models/apn/notification.rb:87:in `process_push!'
/app/vendor/bundle/ruby/1.9.1/gems/stateflow-0.4.2/lib/stateflow/transition.rb:33:in `execute_action'
/app/vendor/bundle/ruby/1.9.1/gems/stateflow-0.4.2/lib/stateflow/transition.rb:23:in `find_to_state'
/app/vendor/bundle/ruby/1.9.1/gems/stateflow-0.4.2/lib/stateflow/event.rb:19:in `fire'
/app/vendor/bundle/ruby/1.9.1/gems/stateflow-0.4.2/lib/stateflow.rb:61:in `fire_event'
/app/vendor/bundle/ruby/1.9.1/gems/stateflow-0.4.2/lib/stateflow.rb:35:in `block (2 levels) in stateflow'
/app/app/workers/push_notification_worker.rb:7:in `block in perform'
/app/app/workers/abstract_worker.rb:8:in `block (2 levels) in wrap'
/app/vendor/bundle/ruby/1.9.1/gems/mongoid-2.2.3/lib/mongoid.rb:130:in `unit_of_work'
/app/app/workers/abstract_worker.rb:8:in `block in wrap'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/benchmarkable.rb:43:in `block in benchmark'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/usr/local/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/benchmark.rb:5:in `ms'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/benchmarkable.rb:43:in `benchmark'
/app/app/workers/abstract_worker.rb:7:in `wrap'
/app/app/workers/push_notification_worker.rb:5:in `perform'
/app/vendor/bundle/ruby/1.9.1/gems/qu-0.1.3/lib/qu/payload.rb:23:in `perform'
/app/vendor/bundle/ruby/1.9.1/gems/qu-0.1.3/lib/qu/worker.rb:49:in `work'
/app/vendor/bundle/ruby/1.9.1/gems/qu-0.1.3/lib/qu/worker.rb:57:in `block in start'
/app/vendor/bundle/ruby/1.9.1/gems/qu-0.1.3/lib/qu/worker.rb:57:in `loop'
/app/vendor/bundle/ruby/1.9.1/gems/qu-0.1.3/lib/qu/worker.rb:57:in `start'
/app/vendor/bundle/ruby/1.9.1/gems/qu-0.1.3/lib/qu/tasks.rb:5:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
@bkeepers
Copy link
Owner

Looking at the exception, I can't figure out what is causing it. Is there a more helpful message along with the exception? Any time I've seen the InvalidDocument exception, it usually does a pretty good job of explaining why it's invalid.

@fbjork
Copy link
Author

fbjork commented Oct 27, 2011

When I removed the generated_at field the exception went away. So it looks like it didn't like the ActiveSupport::TimeWithZone class?

@bkeepers
Copy link
Owner

Ah, yeah. I just ran into that on another project the other day. We had to switch to Time.now.utc. Not sure what the proper solution is.

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

2 participants