Apache shoots to ~100%; vendor-ezyang-No such file or directory, Permission denied #5561

Closed
ipguru99 opened this Issue Jan 23, 2017 · 6 comments

Projects

None yet

2 participants

@ipguru99

DO NOT DELETE THIS INFORMATION.

Please read this information carefully.

GitHub issues is for feature requests or bugs, please do not post issues asking for help or how to do X, Y or Z.
You can use our irc channel ##librenms on freenode to ask questions or our community site.

Please confirm each of the sections below by putting an x in the box like [x].

  • [x ] Is your install up to date? Updating your install
    Please do not submit an issue if your install is not up to date within the last 24 hours or on a stable monthly release.
  • [ x] Please include all of the information between the ==================================== section of ./validate.php which you can run from the cli.
  • Unless your issue is for a WebUI fix or feature then please provide ALL info asked for here.
  • [ x] Please provide as much detail as possible.
  • [x ] Please do NOT post more than 10 lines of debug information here, use a pastebin service or GitHub Gists.

LibreNMS | 3807ec9
DB Schema | 157
PHP | 7.0.13-0ubuntu0.16.04.1
MySQL | 10.0.28-MariaDB-0ubuntu0.16.04.1
RRDTool | 1.5.5
SNMP | NET-SNMP 5.7.3

I had an issue with a client on 14.04 and Apache just crawling. There were < 10 devices being monitored, all Cisco gear.. almost all modules turned off. It was a PC, not a server, so the first thing I did was add RRDCACHED, verified it was working. Still, just terribly slow.

We started over with a real server (I have this running on servers for about 10 of my clients right now, so this was not my first time installing or tweaking). It is still terrible! Very slow to bring up some pages??

I am a network guy, not really a software guy, so I started searching for troubleshooting Apache issues. Then I remember I have NFSen also running on this box.. and it runs great??

So I watch 'top' and get the process ID of Apache skyrocketing. I do a "strace -p XXXX" and BOOM.. here is what I see:

stat("/opt/librenms/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/HTML", 0x7fff27ef0820) = -1 ENOENT (No such file or directory)
access("/opt/librenms/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer", W_OK) = -1 EACCES (Permission denied)

There are hundreds of these lines every time I click on a device. I have access to one of my older clients and their LibreNMS install (that is also up to date). There is a directory missing in the newer install (I have verified twice, by just starting on a totally new install):

Old:
root@nms:~# stat /opt/librenms/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/HTML | grep Acc
Access: (0755/drwxr-xr-x) Uid: ( 999/librenms) Gid: ( 999/librenms)
Access: 2017-01-19 16:25:19.455990986 -0600

New:
root@il-itlibrenms:~# stat /opt/librenms/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/HTML | grep access
stat: cannot stat '/opt/librenms/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/HTML': No such file or directory

I can copy over the HTML directory from the old server and put it on the new server.. the performance improves.. but it is still slower.

What to do here?

@laf
Member
laf commented Jan 24, 2017

Can you try this patch:

diff --git a/includes/common.php b/includes/common.php
index 040e846..0120a12 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -1503,9 +1503,10 @@ function clean($value)
  */
 function display($value)
 {
-    $purifier = new HTMLPurifier(
-        HTMLPurifier_Config::createDefault()
-    );
+    global $config;
+    $p_config = HTMLPurifier_Config::createDefault();
+    $p_config->set('Cache.SerializerPath', $config['temp_dir']);
+    $purifier = new HTMLPurifier($p_config);
     return $purifier->purify(stripslashes($value));
 }

@ipguru99

Thanks laf!

I am sorry to be such a beginner here.. but I tried to do some reading and did this:

cd /opt/librenms
vi p1.patch

  • inserted what you specified above
    The result:
    root@librenms:/opt/librenms# git apply --stat p1.patch
    fatal: corrupt patch at line 18

Am I even close??

@laf
Member
laf commented Jan 25, 2017

git apply p1.patch would be fine, if it still doesn't work add a new line to the bottom of the patch

@ipguru99

It was the line at the bottom! Thanks!
As this thing runs, it seems to pick up speed. Now I can't tell if the patch helped. I still see Apache freak, but just for a second or two (I also see rrdcached, but that never gets to ~90% like Apache). I did copy that directory over from another customer:

/opt/librenms/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/HTML

...so now this server has that directory. If I pause over the device and let the 6 mini-graphs fill out, the click is almost instantaneous.. but not all the time. I am starting to think this might have something to do with their internal network. The performance is just a little better than when it was on an old PC. NONE of my other customers are experiencing anything like this. And one of my customers has over 10,000 ports now.

I would like to test back and forth.. how do I remove that patch? Thanks for your help. This is a new customer and I have had such good luck with Nacho that this is my standard offering. The guys is being cool about it, though.. he loves the interface. Everyone does!

@laf
Member
laf commented Jan 25, 2017

git checkout includes/common.php

I'll probably pr this fix up anyway.

@ipguru99

Thanks again! I did revert back.. just to see if the guy notices. Thanks again for your help!!

@ipguru99 ipguru99 closed this Jan 25, 2017
@laf laf added a commit to laf/librenms that referenced this issue Jan 25, 2017
@laf laf fix: HTML Purifier would create tmp caches within the vendor folder, …
…moved to users tmp dir #5561
a60a754
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment