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

Processes problems with new pid constraint/key #210

Closed
dereuromark opened this issue Jan 10, 2019 · 9 comments
Closed

Processes problems with new pid constraint/key #210

dereuromark opened this issue Jan 10, 2019 · 9 comments

Comments

@dereuromark
Copy link
Owner

[PDOException] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-heroku-app' for key 'pid' in /app/vendor/cakephp/cakephp/src/Database/Statement/MysqlStatement.php on line 39

Is now thrown now every time a worker is started.
is the process pid always 4 here? it seems so.. maybe we need to do sth different then.

@garas
Copy link
Contributor

garas commented Jan 10, 2019

Probably Heroku doesn't have posix_getpid() at all and always used $this->QueuedJobs->key(), and getmypid() on Heroku returns hard coded value. Everywhere I've checked both functions returns same value if posix_getpid() exists. I don't have access to Heroku to check these things.

Maybe I will look why bin/cake queue end didn't work on Windows when it used sha1 key.

@garas
Copy link
Contributor

garas commented Jan 13, 2019

I think QueueProcesses.pid could be dropped and always use sha1 QueueProcesses.workerkey as process identifier.

Some other systems could have posix_getpid() with hardcoded PID and could have the same problem.

@dereuromark
Copy link
Owner Author

I agree for the identification of the running jobs. Still dont want to keep pid though if one manually wants to look into the server and kill them by hand.

@garas
Copy link
Contributor

garas commented Jan 14, 2019

Unique index on (pid, server) could be dropped as it has problems after unclean exits / external kill. After this, getmypid() could be re-added.

pid should be left for killing purposes only, everywhere else workerkey or id should be used.

@dereuromark
Copy link
Owner Author

Are you able to help out here maybe?

@garas
Copy link
Contributor

garas commented Jan 14, 2019

Yes, I'll try to implement this.

@dereuromark
Copy link
Owner Author

Any update here? Or can I help?

@garas
Copy link
Contributor

garas commented Feb 8, 2019

I did not have enough free time to look at this. I'm not sure if I'll be to help here in next few weeks, sorry.

@dereuromark
Copy link
Owner Author

For now unique of pid+server seems to suffice even for heroku and multi-server use cases it seems.
Just needs a unique server name set up here.

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

No branches or pull requests

2 participants