Cifs losing data or changing permissions on files on Ubuntu 11.10 ((12)Cannot allocate memory: file permissions deny server access:)

I hope this is the right place for this. I have a Ubuntu 11.10 server with Apache on. Apaches doc root is on a shared folder sourced via cifs from a windows Machine.

All this is fine on every network I have set it up on until today when I came to set it up at home.

I am viewing my website, on my Apache server in a web browser (lets say Firefox) and every couple of refreshes I get a 403 response or no data at all back for certain files from the servers cif share in Firebug.

Now through the process of elimination I have been able to determine it is cifs. I came to this conclusion by copying my doc root to a local folder on the Ubuntu install and trying to get the same behaviour, which I did not.

Now I understand this is very hard to grasp through plain text so here are a couple of pictures to describe the problem.

This first picture shows everything on one refresh and it is all fine:
Image of everything working

This picture shows the next refresh, as you can see Firebug responds that apache suddenly cannot access my files, not only that but what Firebug is not reporting that there are also images missing off of that page. I should mention the images actually come from DB, so not sure how cifs is interferring with that but the images work with the local version of the site so it must be.
Image of the problem

This problem is intermitant.

Now I did try and Google this but then I realised, after a couple of tries, I wasn’t actually quite sure what to Google for.

Can some one point me in the right direction to diagnose my problems? Maybe some one has had this problem before and can share their solution?

Thanks,

Update: Ok so I did a little searching around in the APache logs and it comes up with this:

[Thu Jan 19 20:59:03 2012] [error] [client 192.168.153.1] (12)Cannot allocate memory: file permissions deny server access: /server_ws/htdocs/css/960.css, referer: http://stagex.co.uk/stream

I have seen this error quite a lot and it always has a different meaning. So first I decided to check the actual file permissions in Linux before I did a refresh after this problem:

drwxrwxrwx 1 www-data sam      0 2012-01-17 18:33 .
drwxrwxrwx 1 www-data sam   4096 2012-01-17 21:40 ..
-rwxrwxrwx 1 www-data sam  10641 2012-01-17 18:33 960.css
-rwxrwxrwx 1 www-data sam      0 2012-01-20 18:58 c_css.css
-rwxrwxrwx 1 www-data sam 129488 2012-01-17 18:33 main.css
-rwxrwxrwx 1 www-data sam   1086 2012-01-17 18:33 reset.css
drwxrwxrwx 0 www-data sam      0 2012-01-17 18:33 .svn

Everything looks tip top there. So I checked Windows to make sure I will always have access to it. I have shared the server_ws folder from windows using the built in protocol and have assigned my Windows user “Sam” as the owner. I have told cifs to hook into this Windows like so:

//192.168.0.2/server_ws/the_stage /media/server_ws cifs username=Sam,password=****,rw,uid=www-data,gid=sam,iocharset=utf8,dir_mode=0777,file_mode=0777 0 0

Nothig immediately wrong there and if there was something terrible there why would it only happen every so oftern.

Though now that I’ve found the error in Apache Ima do more Google searching.

If anyone knows something please let me know 🙂

Answer

I think I found it. This is actually a subset of a more common problem: http://alan.lamielle.net/2009/09/03/windows-7-nonpaged-pool-srv-error-2017. I found this solution a long time ago for another problem but never thought of using it here.

It seems on some installs you must tell Windows to act as a file server by setting the registry keys above. If you do that then it seems Windows will always allocate the resources required to complete a transfer even if its intensive.

I cannot get my server to repeat this problem now :D.

Thank you, Luis for you help without the thought of checking Apache again I would never have got to the bottom of it.

Attribution
Source : Link , Question Author : Sammaye , Answer Author : Sammaye

Leave a Comment