[SERVER-18970] fassert in gridfs after an unclean shutdown Created: 15/Jun/15  Updated: 16/Jun/15  Resolved: 16/Jun/15

Status: Closed
Project: Core Server
Component/s: GridFS, MMAPv1
Affects Version/s: 2.4.3, 2.6.10
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Chris Wang Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS v6.4


Attachments: Text File mongod.log    
Operating System: Linux
Participants:

 Description   

I am running a single mongodb server in CentOS v6.5 64bit.
One day, the server was down due to power's problem.
After server's restarting, there has been a problem with mongodb's gridfs.
Some files cannot be read, and repair cannot work. At that time, the mongo version wat v2.4.3.
I thought it wat old version's bug, so I upgraded the version to v2.6.10.
But the problem is still.

I store many small files is gridfs, with gridfs's id to access the file, such as:
http://xxxx/media/557e84883e2ff5522200001f/file.jpg

How can I fix this problem? And ensure the old files id not be changed.

Assertion: 10334:BSONObj size: 0 (0x0) is invalid. Size must be between 0 and 16793600(16MB) First element: EOO



 Comments   
Comment by Ramon Fernandez Marina [ 16/Jun/15 ]

Thanks for your report chrisloong. If an unclean shutdown of the machine leaves the filesystem in an inconsistent state then it's possible for any file that was open to appear corrupt. You may want to consider protecting against power failures with a UPS, or using replication, or both.

Please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience. A question like this involving more discussion would be best posted on the mongodb-user group.

Regards,
Ramón.

Comment by Chris Wang [ 15/Jun/15 ]

It seems that some files in gridfs were corruption.
I write a ruby script, export all fine files to disk.
Then enter mongo, drop fs.files, fs.chunks and the collection from database, and the command repair and dump can work.
At last, insert all files back to mongodb with ruby script.
Some files are lost, and all files id are changed.
It was a harsh lesson learned.

Generated at Thu Feb 08 03:49:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.