tmpwatch can erase the EMS jar

Elias Ross genman at noderunner.net
Sat Sep 27 03:39:29 UTC 2014


On Fri, Sep 26, 2014 at 10:09 AM, Thomas Segismont <tsegismo at redhat.com> wrote:
> Hi Elias,
>
> Le 24/09/2014 19:39, Elias Ross a écrit :
>>
>> I have a bug: https://bugzilla.redhat.com/show_bug.cgi?id=1146167
>>
>> Basically I have a tmpwatch process in place (EL6) and eventually it
>> will delete the org-mc4j-ems-impl123xxx.jar file causing all sorts of
>> trouble.
>
>
> I assume your tmpwatch process actually deletes anything "old" in the
> ${RHQ_AGENT_HOME}/data/tmp directory, is that correct?

No, /tmp ... I wouldn't delete files from there.

-bash-4.1$ ls -l /tmp
-rw-r--r-- 1 rhq        rhq      156761 Sep 24 19:30
org-mc4j-ems-impl6255191164114698773.jar

I don't see the Tomcat connector files, etc.

>
> If it is, then be careful as this directory is used by the plugin container
> and many plugins to store all sorts of "not so temporary" files (drift
> change sets, bundle assets, plugin classloaders repositories, ... etc).

I do see the file created in the right place too, but with an earlier date.

$ pwd
/opt/rhq/rhq-agent/data/tmp
$ ls -l *.jar
-rw-r--r-- 1 rhq rhq 156761 Sep 24 19:12
org-mc4j-ems-impl2765248756611028873.jar

>>
>> Is there some reason EMS does this sort of thing? Why not just include
>> the impl file in the JMX plugin?
>
>
> It does this for any EMS connection configured to copy connection classpath
> entries to a temporary directory. For example, if your agent monitors an RHQ
> server and a Tomcat 7 server, you'll find:
>
> RHQ_AGENT_HOME/data/tmp/catalina5297975227644168190.jar
> ^^ for Tomcat specifics
> RHQ_AGENT_HOME/data/tmp/jboss-client2309635217896455836.jar
> ^^ for JMX connection over AS7 / EAP6 remoting
> RHQ_AGENT_HOME/data/tmp/org-mc4j-ems-impl912877660320334049.jar
> RHQ_AGENT_HOME/data/tmp/org-mc4j-ems-impl3321936392506161416.jar
> ^^ one for Tomcat, one for RHQ Server
>>
>> I'm going to make the change to not use an embedded impl. Please let
>> me know if this is not the right idea.
>
>
> IMO, you should try to change the TomcatServerComponent class so that the
> EMS connection temporary directory becomes something recognizable, like:
> ====
> RHQ_AGENT_HOME/data/tmp/tomcat-xxxx.ems
> ====
>
> Then you'd be able to configure your cron job to leave it alone.

Okay, I don't really know entirely what's going on here, to be honest.

First of all, I don't know know why I ran into ClassNotFoundException
for mc4j classes. Some hosts have org-mc4j in /tmp, some don't. Maybe
the classloader was loading this class from the /tmp/ directory.

I think it might have to do with discovery. I'm thinking the discovery
classloader might put this .jar in /tmp, but I'm not sure.

The -impl jar doesn't really have any need to exist. I changed the
plugin to eliminate the impl.jar entirely (just one .jar file) and I
removed all the classes to support JDK 1.4. And it is a bug for things
to appear in /tmp that are needed long term anyway.


More information about the rhq-devel mailing list