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
invalid message format #339
Comments
This error is happening at the driver level and not inside pg-boss. All references I've found searching the pg driver and other similar errors mention unicode characters. Does one of your queues have any backslash characters? If it's concurrency-related, is a connection pooler such as pgbouncer being used in front of postgres? I'd be interested in finding out if reducing your instance count makes this go away, for example. |
I only use queue names with underscore's. This happened just after upgrading from 6 to 7 of pg-boss, nothing else changed on our prod server nor postgres db. Thats why I wondered if there might be a code change that causes this. But couldnt find out. |
Out of the 20 instances, how many have |
By the way, |
All 20 instances are workers (=true) Increased I am now running 25 instances on localhost. But no errors in sight 🙈 I also found another error on the prod server:
Also not sure where this is coming now. Never happened before with 6.x |
That error in interesting. 6.2.2 added an algo that uses a bigint for advisory locking to allow multiple instances to run on the same server and not block each other for cron processing. However, the internal timekeeper worker has no reference to this code and no other bigint data types are in the schema. This error looks like the queue name is trying to be explicitly cast to bigint for some reason. Is this error repeatedly thrown, or did it only happen during upgrade? |
There are multiple of these errors:
|
Try passing in the connection as the db prop in the constructor to log each statement out. const options = {
db: {
executeSql: (text, values) => {
console.log(JSON.stringify({text, values}))
return pool.query(text,values)
}
}
} |
Ok I am now logging the queries, lets wait for the next error. BTW. I also got more funny errors 🙈 I dont understand where this is coming from. My other pg-boss instances (other projects, same DB host) running without those crazy errors...
|
Now I could reproduce it on my localhost with one worker! Yey. Simple: one of my sync jobs hit another URL (via axios) to trigger a sync on another machine.
I found this out while adding a try catch to the db.js =>
(I could not figure out how to do this in the constructor as you suggested here, because not sure how I get the This then showed this weird error Solution: Now is the question, what changed from 6.x to 7.x that broke that? Because that code was the same before and was running for months. Maybe you can add a little check (or try/catch) if there is a circular dependency when stringify'ing the response before storing into the job table? Thanks for your time! |
Glad you tracked it down! You can re-open this so we can track it for a fix. |
I am seeing the same error as above and it seems to cause I have created a test using an Axios error that fails via a time out master...rgharris:pg-boss:circular-error:
Thank you! |
I also saw this lately in our logs. Where jobs were not done/failed correctly |
What version of pg-boss are you using? I pushed a test branch with these changes and it doesn't fail. I added a small type update to job.done(), but this sample reminds me that job.done() needs to be retired in the next semver major. It's not clear enough in the docs that job.done() is obsolete if you pass an async function to work() |
Thanks for looking at this! I am using node v16.19.1 and pg-boss 8.4.2. It looks like the difference is that my test uses a different version of axios that has a circular reference in the error. The test fails with your branch after changing the axios version: The actual code where I ran into this isn't using job.done() but I followed the pattern of the other tests for simplicity. |
I am not using the done() function, just the normal Promise approach. And I am getting this error "invalid message format" due to the circular reference in the AxiosError.
|
I had the exact error. I was using Axios 1.2.0 and PG boss 6.2.2. It happens due to axios unable to handle some cases read here Not sure if pg boss version upgrade solves it but as its on axios's end, a quick upgrade to axios 1.2.2 would fix the issue. |
Hi,
I am receiving odd pg errors after I upgraded to version 7.4 (from 6.x) "invalid message format" - and I have no ideas how to debug this, or where this is coming from.
It only happens rarely, and overall the job processing works.
I run 20 node instances with the pg-boss worker on each instance:
Full error:
Also seeing this for other queues like:
__pgboss__cron
, and my own queuesfetch_xyz
.Do you know where to look for to fix this?
The text was updated successfully, but these errors were encountered: