Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

incompatible with mod_ruid2 #635

Open
GoogleCodeExporter opened this issue Apr 6, 2015 · 19 comments
Open

incompatible with mod_ruid2 #635

GoogleCodeExporter opened this issue Apr 6, 2015 · 19 comments

Comments

@GoogleCodeExporter
Copy link

I am running Apache 2.4 with mod_ruid2 and mod_pagespeed. I think the problem 
is mod_ruid2 because users run their own processes. So mod_pagespeed is trying 
to acces the folder(s) as a user instead of apache.

[code]
ls -ld /var/cache/mod_pagespeed
drwxr-xr-x 44 apache apache 4096 Mar  5 00:22 /var/cache/mod_pagespeed
[/code]

[code][Tue Mar 05 00:28:10.928752 2013] [pagespeed:error] [pid 8813] 
[mod_pagespeed 1.1.23.2-2258 @8813] Failed to mkdir 
/var/cache/mod_pagespeed/FtoZvGwwZ5ZVhZcMP-V9.outputlock: Permission denied
[Tue Mar 05 00:28:10.928780 2013] [pagespeed:error] [pid 8813] [mod_pagespeed 
1.1.23.2-2258 @8813] Failed to mkdir 
/var/cache/mod_pagespeed/fnFvXkOcs0MEl7oV4FzE.outputlock: Permission 
denied[/code]

Changing permission to 777 didn't help. How to solve this issue?

Original issue reported on code.google.com by dy...@o2x.nl on 4 Mar 2013 at 11:51

@GoogleCodeExporter
Copy link
Author

If you can upgrade to version 1.3.25.3 you'll find that we no longer write 
lock-files into the file-cache dir, instead using shared memory.  Another 
helpful workaround would be to use memcached rather than the file-system.

Will this sort out the problem for you?

Original comment by jmara...@google.com on 5 Mar 2013 at 12:01

  • Changed state: RequestClarification

@GoogleCodeExporter
Copy link
Author

Thanks for your fast reply! I removed the stable RPM and tried the beta but the 
error still appears..

[Tue Mar 05 01:28:15.260783 2013] [pagespeed:error] [pid 10664] [mod_pagespeed 
1.3.25.3-2556 @10664] 
/var/cache/mod_pagespeed/http,3A/,2Fxx.nl/templates/xx/css/print.css,zSBF29:0: 
opening temp file: Permission denied
[Tue Mar 05 01:28:15.260961 2013] [pagespeed:error] [pid 10664] [mod_pagespeed 
1.3.25.3-2556 @10664] Failed to make directory 
/var/cache/mod_pagespeed/rname/ce_-XVuvzDd0FwXM1CDlkEl/http,3A/,2Fxx.nl: 
Permission denied
[Tue Mar 05 01:28:15.261001 2013] [pagespeed:error] [pid 10664] [mod_pagespeed 
1.3.25.3-2556 @10664] Could not create directories for file 
/var/cache/mod_pagespeed/rname/ce_-XVuvzDd0FwXM1CDlkEl/http,3A/,2Fxx.nl/template
s/xx/css/print.css,40,40_,
[Tue Mar 05 01:28:15.261044 2013] [pagespeed:error] [pid 10664] [mod_pagespeed 
1.3.25.3-2556 @10664] 
/var/cache/mod_pagespeed/rname/ce_-XVuvzDd0FwXM1CDlkEl/http,3A/,2Fxx.nl/template
s/xx/css/print.css,40,40_,DfgZGO:0: opening temp file: No such file or directory

Original comment by dy...@o2x.nl on 5 Mar 2013 at 12:31

@GoogleCodeExporter
Copy link
Author

Great; now you are not getting messages about the lock files, only the cache 
files.  The second part of my suggestion was about deploying memcached, which 
should eliminate most references to cache files.

See https://developers.google.com/speed/docs/mod_pagespeed/system#memcached

Original comment by jmara...@google.com on 5 Mar 2013 at 3:18

@GoogleCodeExporter
Copy link
Author

I haven't look at memcached yet. Maybe stupid but; does memcached work well 
with different fileowners? Because of mod_ruid2 I can not point memcached to a 
single user like 'apache'.

Original comment by dy...@o2x.nl on 5 Mar 2013 at 7:27

@GoogleCodeExporter
Copy link
Author

I'm not sure how well memcached will work across UIDs but I think it's 
basically just a TCP/IP socket connection and that UID won't matter.  Please 
give it a try and let us know.  If you are serving multiple users then 
scalability may also be important and memcached can help with that.

Another thought crossed my mind, though, which you might also try if you want 
to stick with a file-cache.  If there is a distinct VirtualHost for each user, 
you can give each VirtualHost a distinct file-cache path, and ensure that the 
correct user owns each cache.  That might be more inline with the security 
policy you are trying to enforce by using mod_ruid2.

Original comment by jmara...@google.com on 5 Mar 2013 at 1:12

@GoogleCodeExporter
Copy link
Author

Hello,

mod_ruid2 works well with mod_pagespeed, but mod_ruid2 doesn't work with 
disk_cache_module, file_cache_module and mem_cache_module. 

In this case I am using xcache.

Original comment by a...@infokarawaci.com on 7 Apr 2013 at 9:33

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

I have have setup a few new servers Centos6.5 with Ruid2 recently ... I managed 
to add pagespeed , setting up individual file-cache path/folder for each 
VirtualHost.
I also figured out that the path for the statistic log file is global so the 
choices are to set the log file permission to 777 or to disable statistic logs 
all together.

The above was great, until apache error logs flooded with messages like:

Serf status 4 (Interrupted system call ) polling for 15: (threaded)

The errors go away when i disable mod_ruid2 and come back when i enable it so 
it's directly related somehow. I ended up having to disable mod_pagespeed for 
now and i'm in search of some pointers on how to fix this. I came across a 
couple of other threads mentioning the same problems , but no fix for it :-(.

Michael

Original comment by i...@dmtec.com.au on 9 May 2014 at 9:33

@jeffkaufman
Copy link
Contributor

cPanel documents that mod_ruid2 isn't compatible with mod_cache or the other normal apache caching modules for the same reason we're not: the permissions for cache files. So we should probably just say we're not compatible with mod_ruid2.

@jmarantz did describe two workarounds above though:

@jmarantz
Copy link
Contributor

Wanted to capture this from ernexus:

"We are getting those errors very often (sometimes even few seconds apart for same users):
Failed to read cache clean timestamp /home/user/tmp/mod_pagespeed/!clean!time!. Doing an extra cache clean to be safe.

We do not get any other major errors, some "Fetch timed out" from time to time. My guess it could be due the overload of cache cleans."

@jeffkaufman
Copy link
Contributor

Note additional details in #1323, like !clean!time!

@jeffkaufman jeffkaufman changed the title mod_pagespeed and mod_ruid2 not working together? mod_pagespeed incompatible with mod_ruid2 Jun 27, 2016
@jeffkaufman jeffkaufman changed the title mod_pagespeed incompatible with mod_ruid2 incompatible with mod_ruid2 Jun 27, 2016
@ernexus
Copy link

ernexus commented Jul 5, 2016

Any news? Is there any plans to fix the issue in near future?

@jeffkaufman
Copy link
Contributor

No plans to fix this, currently. See my comment above #635 (comment)

The most reliable workaround would be to run PageSpeed on a separate server in front of your mod-ruid2 server, as a reverse proxy. Something like nginx + ngx_pagespeed with proxy_pass.

@ernexus
Copy link

ernexus commented Jul 6, 2016

I that case we are going to compile our own Pagespeed version, which may solve the problem.

@jeffkaufman
Copy link
Contributor

Cool; keep us posted!

@ernexus
Copy link

ernexus commented Jul 13, 2016

We managed to solve the file reading problem by compiling modified version of Pagespeed. We have changed the default permissions from 600 to 644 for !clean!time! and other temp files. It is not the best solution (would be better to fix owners), but it works in server with mod_ruid2.

@jmarantz
Copy link
Contributor

ernexus -- we were discussing a code-change for lock-file permissions, but we think this will still have problems because the cache garbage-collector won't be able to delete files owned by another user.

In the other bug I suggested having a separate and disjoint FileCachePath per vhost. Did you every try that? I really think that's the way to go.

@ernexus
Copy link

ernexus commented Jul 15, 2016

Yes, we are currently using separate FileCachePath for each user. But the owners were still wrong, because of the mod_ruid2 (it takes the last owner of the Apache process and it could be anyone). We applied new folder creation rule for every user cache folder with ACL for 777, but the new files were still 600. So after the mod, files now 644. Because the folders have 777 i believe it can be purged. We are not getting any more errors after the modification.

It would be better to get proper owner, but we couldn't manage to get it working. Sorry i am not that familiar with Pagespeed code and programming language.

@anyandallart
Copy link

I'm running Centos 7 and Cpanel/WHM, and mod_ruid2 is enabled by default. I can get pagespeed to work if I disable mod_ruid2 and enable mod_suphp. I'm running a relatively small server so I just wanted to make sure there wasn't a big problem with that. I've read that mod_suphp is at "end of life," I just hope I'm not doing something that will affect me in the future. Any suggestions?

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

No branches or pull requests

5 participants