Re: PHP module spams httpd error.log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/03/2011 03:59 AM, Sandro Santilli wrote:
> On Fri, Dec 02, 2011 at 09:10:48PM -0500, Ed Hynan wrote:
>>
>> Using Ming PHP module with Apache on Ubuntu 10.10
>> (package version; Ming 0.4.3).
>>
>> This:
>>
>> WARNING: changing SWF target version during a run
>>          might result in malformed SWF output.
>>          You don't have to worry if you're careful about
>>          not mixing different version blocks in a movie.
>>
>>
>> is written again and again to Apache's error.log.  My
>> code is not changing the version anywhere; it's set
>> with SWFMovie() and ming_useswfversion(), same in both cases.
>>
>> I haven't found a way to stop it. Any ideas?
> 
> Idea for your case: don't use both calls, 1 is enough.

Well, I was being brief in that message. I didn't start
with both, but then tried anything I could think of.

> 
> Idea for improving Ming: send a patch checking for actual
> version and not raising the warning if they match...

I had looked at the 0.4.4 code before subscribing here,
but had to ask before going too far; maybe it was a known
issue. (And I have the same problem as everyone else: time.)

So I've poked around.  In php_ext/ming.c, zm_activate_ming()
(expands from PHP_RINIT_FUNCTION(ming)) eventually gets
called more than once, and each time it calls Ming_init()
in libming, which assigns SWF_versionNum the default 5, and
so the warning is triggered in libming's Ming_useSWFVersion(int).

Why does it get called more than once?  This is not my area.
Maybe Apache, or maybe PHP, load/unload an .so at first, then
keep it loaded after some amount of use? Not likely; more
likely something to do with Apache's pre-forked processes, but
then why is one initialized ming.so shared? I don't know.

Whatever the cause, the ming php module, and surely the other
language modules, will have to guard against re-initialization.

To explain, here's a small patch (_not_ a proposed patch):

--- ming.c-orig	2011-10-26 02:33:18.000000000 -0400
+++ ming.c	2011-12-03 11:13:13.000000000 -0500
@@ -6199,6 +6199,17 @@

 PHP_RINIT_FUNCTION(ming) /* {{{ */
 {
+	/* EH: Sat Dec  3 09:41:51 EST 2011 */
+	static int init = 0;
+	setlinebuf(stderr);
+	if (init == 0) {
+		init++;
+		fprintf(stderr,"EH: %s -- first init\n", __FUNCTION__);
+	} else {
+		init++;
+		fprintf(stderr,"EH: %s -- init call %d\n", __FUNCTION__, init);
+		return SUCCESS;
+	}
 	/* XXX - this didn't work so well last I tried.. */

 	if (Ming_init() != 0) {

<end patch>

With the static int guarding re-init, and line buffered
messages, I see this in error.log (over several runs):

EH: zm_activate_ming -- first init
EH: zm_activate_ming -- first init
EH: zm_activate_ming -- first init
EH: zm_activate_ming -- first init
EH: zm_activate_ming -- first init
EH: zm_activate_ming -- init call 2
EH: zm_activate_ming -- init call 2
EH: zm_activate_ming -- init call 2
EH: zm_activate_ming -- init call 2
EH: zm_activate_ming -- init call 2
EH: zm_activate_ming -- init call 3
EH: zm_activate_ming -- init call 3
[Sat Dec 03 11:39:46 2011] [error] [client 192.168.1.187] File does not
exist: /var/www/favicon.ico
EH: zm_activate_ming -- init call 3
EH: zm_activate_ming -- init call 4

BTW, those lines begin after a fresh restart of Apache.
Also, note that the warning I asked about does not appear;
returns w/o Ming_init() after the 1st call.

My next question is: can libming handle reuse, possibly
from any number of scripts doing different things, maybe
setting different versions?  Could the simple guard
against reinit work in the real world?

- Ed




> 
> --strk; 
> 
>   ()   Free GIS & Flash consultant/developer
>   /\   http://strk.keybit.net/services.html
> 
> --

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Ming-users mailing list
Ming-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ming-users


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux