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

Attempting to save an image-rich presentation causes an error from Mongo #69

Open
banksJeremy opened this issue Jun 14, 2012 · 2 comments
Labels

Comments

@banksJeremy
Copy link
Collaborator

The error that shows up in Mongo's log is vague...

Assertion: 10334:Invalid BSONObj size: 21942433

... but it looks like Mongo has a maximum document size the defaults to 16MB and I might be hitting due to having a lot of embedded images.

Butter keeps waiting for a response from Mongo that never comes, so it never closes the connection to the browser, causing a silent failure from the user's perspective.

@banksJeremy
Copy link
Collaborator Author

Inside the handler for app.post('/api/project/:id?', ...) in butter/cornfield/app.js I replaced

doc.save();
res.json({ error: 'okay', project: proj });

with

doc.save(function (err) {
  if ( !err ) {
    res.json({ error: 'okay', project: proj });
  } else {
    res.json( {error: 'internal db error' }, 500 );
  }
});

to fail better. (banksJeremy/butter@4eececb)

This works, and now I'm confused why the failure left a connection open. I'd think that .save() would be async and return instantly, so res.json(...) would be called and close the connection in either case. Maybe it's not async? Weird.

@banksJeremy
Copy link
Collaborator Author

Filed upstream: t1603

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

No branches or pull requests

1 participant