in reply to DProf + Safe = corrupted tmon.out

I have a couple of suggestions for you. First, in your first script that triggers the problem, turn off warnings. According to the perldebug docs:

"The debugger does not currently work in conjunction with the -W command-line switch because it itself is not free of warnings"

In other words, the debugger can be buggy, so you have to play with it.

Second, for me at least, I don't think that Safe and Devel::DProf are a good fit for use on mod_perl and Apache. Safe, for example, has safety issues. To quote the author:

"Any string eval which is executed by code executing in a compartment, or by code called from code executing in a compartment, will be eval'd in the namespace of the compartment. This is potentially a serious problem."

Also, Safe might also eat up all of your memory; it might also cause infinite looping; it might also open the door to snooping, viruses, etc.; it might also cause signals to interfere with your processes. That's not to say that Safe shouldn't be used here, but you might want to reconsider it.

Apache::DProf, which implements Devel::DProf in Apache, works fine on perl code in Apache, but what about non-perl code? Apache recommends using gdb. So do I. See:

Apache HTTPD Debugging Guide

Replies are listed 'Best First'.
Re^2: DProf + Safe = corrupted tmon.out
by smammy (Novice) on Oct 20, 2006 at 15:34 UTC

    Sadly, turning off warnings doesn't help the situation.

    Regarding Safe, we're aware of these issues. The code we're dealing with is written by trusted authors -- the safe compartment is just a level of insurance against accidental flaws. We also use resource limits and an alarm handler to prevent inadvertent DDoS attacks.

    Regarding Devel::DProf, my goal is to profile my perl code -- I don't care about debugging or profiling Apache itself.