forking & (mysql)sockets

A

arnevt

Hi

I'm writing a small getcounter script, and due to growing pains, I want it
to fork all it's queries (to a max of 5 forks, and then waiting to start a
new one until someone get's free).
I had a small issue with Net::SNMP being defined before it was forked, and
all sessions were using the same src-port (with the well known
consequenses). Now there is 1 socket opened to a mysql-server. I was
wondering: all forks have to update the database with their
particular result. Would it cause problems if 2 or more forks were doing
an update through the same $socket (at the same time)?

thx
Arne
 
B

Brian McCauley

Now there is 1 socket opened to a mysql-server. I was
wondering: all forks have to update the database with their
particular result. Would it cause problems if 2 or more forks were doing
an update through the same $socket (at the same time)?

Yes.

And potentially, depending on the statefullness of the mysql protocol,
it would also cause problems even if they took it in turns.

In general[1], unless the protocol makes special provisions, a client
can't fork and share a single connection to a server.

[1] General meaning this is not specific to Perl or mysql.
 
X

xhoster

Hi

I'm writing a small getcounter script, and due to growing pains, I want
it to fork all it's queries (to a max of 5 forks, and then waiting to
start a new one until someone get's free).
I had a small issue with Net::SNMP being defined before it was forked,
and all sessions were using the same src-port (with the well known
consequenses). Now there is 1 socket opened to a mysql-server. I was
wondering: all forks have to update the database with their
particular result. Would it cause problems if 2 or more forks were doing
an update through the same $socket (at the same time)?

I don't know what a "getcounter" script is, and have no experience with
Net::SNMP, but I do know that for general databse work, mysql connections
should be opened after the fork(s), not before.

Xho
 
A

arnevt

I don't know what a "getcounter" script is, and have no experience with
Net::SNMP, but I do know that for general databse work, mysql connections
should be opened after the fork(s), not before.

a "getcounter" script is a script that gets counters :D

i switched to non blocking requests, so i don't have to fork anymore,
problem solved for me :)

arne
 
A

Anno Siegel

a "getcounter" script is a script that gets counters :D

This is either a tasteless joke at the expense of people who are trying
to help you, or you are childishly assuming that everybody lives inside
your head. Immature either way.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,916
Members
47,458
Latest member
Chris#

Latest Threads

Top