Tuesday, June 16, 2015

Caused by: com.mongodb.WriteConcernException: { "serverUsed" : "1.2.3.4:27017" , "ok" : 1 , "n" : 0 , "err" : "new file allocation failure" , "code" : 12520}

You might encounter the following exception:

Caused by: com.mongodb.WriteConcernException: { "serverUsed" : "1.2.3.4:27017" , "ok" : 1 , "n" : 0 , "err" : "new file allocation failure" , "code" : 12520}

You can check your MongoDB server log with the following command:

sudo vi /var/log/mongodb/mongod.log

The log will have the following lines:

2015-06-10T20:19:19.311+0900 I -        [conn7] Assertion: 12520:new file allocation failure
2015-06-10T20:19:19.313+0900 I STORAGE  [FileAllocator] allocating new datafile /var/lib/mongo/test.6, filling with zeroes...
2015-06-10T20:19:19.316+0900 I -        [conn7] Assertion: 12520:new file allocation failure
2015-06-10T20:19:19.316+0900 I STORAGE  [FileAllocator] FileAllocator: posix_fallocate failed: errno:28 No space left on device falling back
2015-06-10T20:19:19.317+0900 I STORAGE  [FileAllocator] error: failed to allocate new file: /var/lib/mongo/test.6 size: 2146435072 failure creating new datafile; lseek failed for fd 22 with errno: errno:2 No such file or directory.  will try again in 10 seconds
2015-06-10T20:19:19.322+0900 I -        [conn7] Assertion: 12520:new file allocation failure

You can notice there is not enough space.

So you can clean up your disk

or relocate MongoDB storage location

to a directory mounted on a different partition or disk.

No comments:

Post a Comment