Page 1 of 2

Abort due to insufficent resources

PostPosted: Sun Mar 20, 2016 2:53 pm
by wd9895
Hi,

I tried to copy hundreds of thousand files from my PC HDD to my Lacie NWS2, FW16.1, and it fails after a few thousand files.
The error message is "not enough resources for the service" and it's independent of using the file explorer, robocopy or simple xcopy command unter Win7 Pro 64.

I also re-installed the regualr kernel to avoid a mix with the beta 4.3.3. kernel but that doen't help as well.

The NWS2 won't be accessible via the network but the webinterface is still alive, so I can reboot. After the reboot the NAS is available again.

Do you have any hint how to go ahead ?

Re: Abort due to insufficent resources

PostPosted: Sun Mar 20, 2016 6:09 pm
by fvdw
Did you check the samba log file for errors? Seems an issue with the samba server. Did you try FTP?
I copy frequently batches of about 20 thousand files and have no issues.

What you experiece smells like a memory leak issue. You could repeat what you while running the Comman "top" in a linux command window usuing ssh server. You will see if sambacis eating up all your memory

Re: Abort due to insufficent resources

PostPosted: Sun Mar 20, 2016 6:49 pm
by wd9895
FTP is still running, Samba stops somewhere in the copy process.

Log file in /var/log/samba

[2016/03/20 19:12:44, 0] smbd/server.c:main(942) smbd version 3.0.37 started. Copyright Andrew Tridgell and the Samba Team 1992-2009
[2016/03/20 19:12:45, 0] passdb/pdb_smbpasswd.c:build_sam_account(1252) build_sam_account: smbpasswd database is corrupt! username xxxxx with uid 1002 is not in unix passwd database!
[2016/03/20 19:17:06, 0] lib/util_sock.c:read_data(534) read_data: read failure for 4 bytes to client 192.168.178.20. Error = Connection reset by peer

Re: Abort due to insufficent resources

PostPosted: Sun Mar 20, 2016 7:00 pm
by fvdw
Mmm...this error is probably caused by your windows 7 pc.
Adapting security settings may solve this.

How? Just do google search with "read failure for 4 bytes to client" and you will find the instructions

Re: Abort due to insufficent resources

PostPosted: Sun Mar 20, 2016 7:01 pm
by wd9895
[2016/03/20 19:51:36, 0] lib/util.c:smb_panic(1633)
PANIC (pid 1642): Could not store share mode entry



[2016/03/20 19:51:36, 0] lib/util.c:log_stack_trace(1737)
BACKTRACE: 0 stack frames:


[2016/03/20 19:51:36, 0] lib/fault.c:dump_core(181)
dumping core in /var/log/samba/cores/smbd


[2016/03/20 19:51:36, 0] lib/util_tdb.c:tdb_log(664)
tdb(/usr/var/locks/connections.tdb): expand_file write of 1024 bytes failed (No space left on device)


[2016/03/20 19:51:36, 0] smbd/connection.c:claim_connection(208)
claim_connection: tdb_store failed with error IO Error.


[2016/03/20 19:51:36, 0] lib/util_tdb.c:tdb_log(664)
tdb(/usr/var/locks/connections.tdb): expand_file write of 1024 bytes failed (No space left on device)


[2016/03/20 19:51:36, 0] smbd/connection.c:claim_connection(208)
claim_connection: tdb_store failed with error Record does not exist.
[2016/03/20 19:51:36, 1] smbd/service.c:make_connection_snum(905)
too many connections - rejected

Re: Abort due to insufficent resources

PostPosted: Sun Mar 20, 2016 7:07 pm
by fvdw
This one is interesting(/usr/var/locks/connections.tdb): expand_file write of 1024 bytes failed (No space left on device)

This file is stored on a ram disk, to prevent disk spin ups, seem the connections database file becomes too big and hangs samba. I remember that we have seen this problem in the past, I forgot what we did to solve it. Later this evening I will do a search in the forum and try to find it in the forum

Re: Abort due to insufficent resources

PostPosted: Sun Mar 20, 2016 7:22 pm
by wd9895
Yes, these files are on a SSD which is like a Ram-disk and are copied to the NAS. So the files come very quickly ....

With Putty I restart the Samba service by
root@Lacie-NS2:/ # killall smbd
root@Lacie-NS2:/ # smbd

Then the copy process continues for the next minutes ....

Re: Abort due to insufficent resources

PostPosted: Sun Mar 20, 2016 8:01 pm
by fvdw
I traced down the information and indeed I have had this problem as well when copying more then 50 thousand files
So your problem is confirmed.

The problem is caused by this, when copying files samba writes data in the files
connections.tdb
locking.tdb

which are present in /rw_fs/tmp/usr/var/locks

Especially the locking.tdb file grows, with each file copied since last boot it becomes 100 byte bigger so after about 50 thousand files it reaches a size of 5MB and then the problem occurs and you get the error no space left on device.
This because we have mounted a ramdisk with name tmpfs on /rw_fs/tmp/usr/var with size of 5MB. This is done to prevent unnecessary disk spin ups as samba seem to write to some files in there even when no files are being transferred.
So all files in /rw_fs/tmp/usr/var/ (incl sub folders) cannot become larger the 5 MB.

When the locking and connection.tdb have grown to occupy all the free space of the ramdisk samba will abort. Only after reboot it will work again because then these files are deleted and reset.

I made a new rcS file that will move these two file from the ramdisk to the normal disk, probably it will not affect the disk standby performance as I think that these files are only written to in case there are file transfer made by the samba server (

Attached an adapted rcS file
Replace the one in /etc/init.d by this one (be sure that after replacing it tit still has executable rights)
After installing it reboot your nwsp2 and try again to copy the files...should work now

---edit 25 march 16

file removed, use the patch file to repair this bug

viewtopic.php?f=7&t=2326#p22293

Re: Abort due to insufficent resources

PostPosted: Mon Mar 21, 2016 10:49 am
by wd9895
Success ! It works.

File attribute of rcS was 755.

Thank you.

Re: Abort due to insufficent resources

PostPosted: Mon Mar 21, 2016 9:11 pm
by fvdw
:punk

we going to include this in 17-0 release