Re: it doesn't return from the mysql_query processing Hi Koki,
You have to re- establish the database connection in each child process.
Otherwise the packets get mangled and you get the errors you're seeing.
Koki Takeda wrote:
> I hope that my contacting you is not an imposition in any way.
>
> My name is Koki Takeda.
>
> This time, I made the php program using MySQL.
>
> The child process is generated in the program, and MySQL query
> are transmitted two or more times in the child process. That's
> my problem.
>
> There is difficultly both executions in a present environment
> though I thought about the following two solutions by
> investigating.
>
> I will inform the following of details. Please teach some
> solutions.
>
> And, please contact me when there are lack information etc.
>
> I would be very happy to hear from you.
>
> ------------------------------------------
> â–* Facts
>
> OS: SunOS xxx 5.8 Generic_108528-23 sun4u sparc
> SUNW,UltraAX-i2 (Solaris 8)
> php: 4.3.9
> Mysql: Ver 4.0.12-standard for sun-solaris2.8 on sparc
>
>
> â–* Content of processing
>
> In the made php program (A temporary name: test.php), it
> transmits repeating MySQL query (select,insert) according to
> MySQL function mysql_query.
>
> And, test.php forking does the process, and operates at the
> same time five child processes.
> MySQL query is transmitted about 2500 times in all child
> process total.
>
> I will explain the outline of the program and the outline of
> the program flow as follows.
>
> <Outline of test.php program>
>
> It is processing that forwards an arbitrary file to
> another server.
>
> <Outline of test.php program flow>
>
> Start
>
> Query execution to acquire file list to be transmitted
> (real environment: About 60 records)
> mysql_query (select)
>
> Ceri execution to acquire server list(real environment:
> Five records)
> mysql_query (select)
>
> Beginning of loop1(loop for a few minutes of server) {
>
> It is a fork as for the process.
>
> if Fork failure {
>
> Error processing
>
> } elseif parent process {
>
> Process ID backup
>
> } else { child process
>
> Beginning of loop2(loop for a few minutes of file
> for forwarding) {
>
> Ceri execution that judges forwarding
> mysql_query (select)
>
> if It is not an object of forwarding
> (Forwarded it. ) {
>
> Ceri execution of log writing
> mysql_query (insert)
>
> Continuance of loop2
>         }
>
> Forwarding execution
>
> End of loop2
> }
>
> End of loop1
>
> Processing that waits for end of all child processes
>
> End
>
>
> â–* symptom
>
> Processing ends normally in case of almost.
> However, in rare cases, it doesn't return from the
> mysql_query processing after mysql_query is called about
> 200-250 times in total by all child process processing, and
> processing stops.
>
> SQL sentence that doesn't return from the mysql_query
> processing is as follows.
>
> ・select updated from table_name_1 where code = 98
>
> ・insert into table_name_2 ( field_name_1,field_name_2,  
> field_name_3,field_name_4,field_name_5 ) values ( '1', '',
> '', 1,'XX#1(doc01)(192.168.1.100):The copy processing was
> skipped.(aaa.xxx) ' )
>
> And Mysqld is done while having started while this symptom
> is occurring.
> And, other Ceri can be executed.
>
> Nonw, when this symptom occurs, kill does me parent process
> and 5 child processes now.
>
>
> â–* Idea of solution
>
> It was able to be confirmed that the following errors might
> occur when test.php was being executed.  Therefore, I
> judged that the buffer might been filled.
>
> <Error message>
> Malformed packet
>
> Then, I considered the idea of the following two solutions.
> However, both influences that it has on other programs are
> large, and time is required for the verification.
> Therefore, I am looking for other solutions.
>
> <Idea of solution>
> (1)After mysql_query is executed, the processing of the
> flush of query cash is added.
> (2)Upgrade of mysql
>
>
> â–* Content of question
>
> Based on above, I want to make the following question.
>
> ・Is there a case similar to this symptom?
>
> ・How was this symptom canceled when there was a similar
> case?
>
> ・Additionally, does another have the thought solution?
>
>
>
> |