Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Trying to run 2 PHP Daemons on the same box seems to create issues in msg q #51

Open
camtnbikerrwc opened this issue May 28, 2014 · 3 comments

Comments

@camtnbikerrwc
Copy link

I have 2 Damons, for 2 differnet purposes.
From ObjectMediatior.php I see the ftok is always the same, this means they both seem to want to use the same msg_q

$tmp = sys_get_temp_dir();
$ftok = sprintf($tmp . '/%s_%s', str_replace('/', '_',
$this->daemon->get('filename')), $this->alias);

Am I missing something about configuring my env to allow multple seperate
Daemons run on the same box.

@shaneharter
Copy link
Owner

There's another defect with this ftok code -- you cannot have workers that
start w/ the same letter. There is some progress on fixing this and a few
other issues in the 2.1.1 branch.

In the meantime, I think you could work around this by giving your daemons
a different filename. Do they have the same name now?

On Wed, May 28, 2014 at 1:18 PM, camtnbikerrwc [email protected]:

I have 2 Damons, for 2 differnet purposes.
From ObjectMediatior.php I see the ftok is always the same, this means
they both seem to want to use the same msg_q

$tmp = sys_get_temp_dir();
$ftok = sprintf($tmp . '/%s_%s', str_replace('/', '_',
$this->daemon->get('filename')), $this->alias);

Am I missing something about configuring my env to allow multple seperate
Daemons run on the same box.


Reply to this email directly or view it on GitHubhttps://github.com//issues/51
.

@camtnbikerrwc
Copy link
Author

I changed names but that did not help since I think ftok uses inodes/fs.

Since the ftok file is created in tmp and unlinked after the ftok call I seem to get the same id.

For now I have replaced the sys_get_temp_dir with a getcwd, my service script always cd's the daemon home directory and this seems to have fixed the issue for now.

At least I get 2 seperate Message Q's.

Thanks for all the great work.

I really appreciate it.

I only have 1 Worker Per Seperate Daemon so I am not hitting that problem. I guess though I could have 2 Differetn Workers, interessting.

ger


From: Shane Harter [email protected]
To: shaneharter/PHP-Daemon [email protected]
Cc: camtnbikerrwc [email protected]
Sent: Wednesday, May 28, 2014 11:41 AM
Subject: Re: [PHP-Daemon] Trying to run 2 PHP Daemons on the same box seems to create issues in msg q (#51)

There's another defect with this ftok code -- you cannot have workers that
start w/ the same letter. There is some progress on fixing this and a few
other issues in the 2.1.1 branch.

In the meantime, I think you could work around this by giving your daemons
a different filename. Do they have the same name now?

On Wed, May 28, 2014 at 1:18 PM, camtnbikerrwc [email protected]:

I have 2 Damons, for 2 differnet purposes.
From ObjectMediatior.php I see the ftok is always the same, this means
they both seem to want to use the same msg_q

$tmp = sys_get_temp_dir();
$ftok = sprintf($tmp . '/%s_%s', str_replace('/', '_',
$this->daemon->get('filename')), $this->alias);

Am I missing something about configuring my env to allow multple seperate
Daemons run on the same box.


Reply to this email directly or view it on GitHubhttps://github.com//issues/51
.


Reply to this email directly or view it on GitHub.

@camtnbikerrwc
Copy link
Author

See source for ftok. probably not a food idea to use an ephemeral file to be the input to ftok.

Probably want a permanent file, I see that after you touch the file and ftok it you unlink it.

best

ger

35 key_t 36 ftok(path, id) 37 const char *path; 38 int id; 39 { 40 struct stat st; 41 42 if (stat(path, &st) < 0) 43 return (key_t)-1; 44 45 return (key_t) (id << 24 | (st.st_dev & 0xff) << 16 | (st.st_ino & 0xffff)); 46 }


From: Shane Harter [email protected]
To: shaneharter/PHP-Daemon [email protected]
Cc: camtnbikerrwc [email protected]
Sent: Wednesday, May 28, 2014 11:41 AM
Subject: Re: [PHP-Daemon] Trying to run 2 PHP Daemons on the same box seems to create issues in msg q (#51)

There's another defect with this ftok code -- you cannot have workers that
start w/ the same letter. There is some progress on fixing this and a few
other issues in the 2.1.1 branch.

In the meantime, I think you could work around this by giving your daemons
a different filename. Do they have the same name now?

On Wed, May 28, 2014 at 1:18 PM, camtnbikerrwc [email protected]:

I have 2 Damons, for 2 differnet purposes.
From ObjectMediatior.php I see the ftok is always the same, this means
they both seem to want to use the same msg_q

$tmp = sys_get_temp_dir();
$ftok = sprintf($tmp . '/%s_%s', str_replace('/', '_',
$this->daemon->get('filename')), $this->alias);

Am I missing something about configuring my env to allow multple seperate
Daemons run on the same box.


Reply to this email directly or view it on GitHubhttps://github.com//issues/51
.


Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants