Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forks don't die #13

Open
lightglitch opened this issue Mar 21, 2013 · 12 comments
Open

Forks don't die #13

lightglitch opened this issue Mar 21, 2013 · 12 comments

Comments

@lightglitch
Copy link

Hi, I'm using this to do some benchmarks and I wanted to wait for the end of the forks, but they never die.

The callback stops being called but the forks don't exit, am I missing something?

@lightglitch
Copy link
Author

After some debugging I found out that if the data array has more than n elements (in my case is 7401 in but this could be just a random number) then the forks don't exit.

I don't know if this could be memory or timeouts configurations.

@lightglitch
Copy link
Author

After a few more tests I found out that has to do with writing the results to the up fifo.
I don't any exception so I don't know what is the real issue.

@RomanShumkov
Copy link
Contributor

Hi, @lightglitch. Could you test my patched version? It has pull requests #8 and #9 merged in.

@lightglitch
Copy link
Author

I didn't try it yet but if comment:

            // phone home
            $fifo->send(array($result, $output, $error));

everything works as expected so the limit is probably the system fifo maxsize.

@kriswallsmith
Copy link
Owner

Are you calling wait() on the process manager?

@lightglitch
Copy link
Author

Yes, because I want to know when all forks ends.

@kriswallsmith
Copy link
Owner

If you can write an example script that demonstrates this issue I'd be happy to look into it.

@lightglitch
Copy link
Author

I added a test in my fork to test it on travis:

https://github.com/lightglitch/spork/commit/c6b84084d8c9a1fc3e3f77383da18353ab7afc6a

it's pretty simple and hangs on travis.

@seyfer
Copy link

seyfer commented Jul 11, 2013

I have same issue.

I' m call wait() on the process manager and it's never ends. :(

in result i have big serialized array.

But if i write something simpe, like

return "work bitch";

it work, and wait() complete. maybe there some settings for result size ?

@seyfer
Copy link

seyfer commented Jul 11, 2013

Some example

$fork = $this->sporkManager->process($requests_iterator, function($request) {

                        Minion_Cli::write(__METHOD__ . "request " . print_r($request, 1));

                        try
                        {
                            $asbresult = $this->asbProcessor->run($request);

                            Minion_Cli::write(__METHOD__ . "asbresult " . print_r($asbresult, 1));

                            return $asbresult;
                        }
                        catch (\Exception $exc)
                        {
                            return $exc->getMessage();
                        }

//                        return "work bitch";
                    });

            $this->sporkManager->wait();

            $results = $fork->getResult();

So i have there test output. $this->asbProcessor do some job, and return result. I have test output marked as "asbresult" and after this daemon stops and newer die.
But if i return some simple string or other small result - it's work.

Please fix !

@seyfer
Copy link

seyfer commented Jul 11, 2013

Now i write result to db in child and it's work. But it's not what i need.

@kriswallsmith
Copy link
Owner

Spork will serialize whatever your callback returns. Is $asbresult serializable?

@seyfer
Copy link

seyfer commented Jul 12, 2013

kriswallsmith, yes it is array or serialized array. I think problem in array size. Like write lightglitch upper

i write better example in this issue
(#7)

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

No branches or pull requests

4 participants