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

v0.12.0 all tasks go to the status discarded with InsertTx #618

Closed
sxwebdev opened this issue Sep 26, 2024 · 7 comments · Fixed by #619
Closed

v0.12.0 all tasks go to the status discarded with InsertTx #618

sxwebdev opened this issue Sep 26, 2024 · 7 comments · Fixed by #619
Assignees
Labels
bug Something isn't working

Comments

@sxwebdev
Copy link

sxwebdev commented Sep 26, 2024

After upgrading to version 0.12.0 all my new tasks created in the following way:

riverClient.InsertTx(ctx, dbTx,
	taskmanager.SomeArgs{
		Key: value,
	},
	&river.InsertOpts{
		UniqueOpts: river.UniqueOpts{
			ByArgs: true,
		},
		ScheduledAt: time.Now().Add(time.Second*30),
	},
)

Began to be marked in the database with the status "discarded"

This problem was solved only in this way:

func (s *Worker) InsertOpts() river.InsertOpts {
	return river.InsertOpts{
		UniqueOpts: river.UniqueOpts{
			ByArgs: true,
		},
	}
}

It looks like unique parameters are ignored at the task creation level.

Before updating to version 0.12.0, I rolled out migrations from scratch

@bgentry
Copy link
Contributor

bgentry commented Sep 26, 2024

I’m not clear on what’s happening or what actually fixed it. You’re saying that you were using insert time UniqueOpts on a prior version with only ByArgs with no problems? And after upgrading, your jobs are somehow being inserted directly into a discarded stste?

I don’t think the discarded state can ever be reached at insert time, or really ever, without the job executing first and having errors, which is why this confuses me. However I don’t doubt that something broke here and It’s likely pretty important. Are there any other logs you can provide, or a minimal code sample to reproduce? Maybe look at the job rows in your database to see if anything looks off? For a discarded job you should see at least some evidence of attempts and having been worked by a worker.

@bgentry bgentry self-assigned this Sep 26, 2024
@sxwebdev
Copy link
Author

sxwebdev commented Sep 26, 2024

I’m not clear on what’s happening or what actually fixed it. You’re saying that you were using insert time UniqueOpts on a prior version with only ByArgs with no problems? And after upgrading, your jobs are somehow being inserted directly into a discarded stste?

I don’t think the discarded state can ever be reached at insert time, or really ever, without the job executing first and having errors, which is why this confuses me. However I don’t doubt that something broke here and It’s likely pretty important. Are there any other logs you can provide, or a minimal code sample to reproduce? Maybe look at the job rows in your database to see if anything looks off? For a discarded job you should see at least some evidence of attempts and having been worked by a worker.

I remember that there were no attempts, the task was never completed, it immediately crashed with the “discarded” status. At the same time, an error with “discarded” was recorded in the meta. Also, the new column with the unique state was also filled with a bit mask. In other words, the task crashed with an error on uniqueness. I will be able to reproduce this only tomorrow. And I did not check whether the uniqueness works now or not, when I specified the method in the worker.

at the same time, all the arguments are absolutely unique

@bgentry bgentry added the bug Something isn't working label Sep 26, 2024
@bgentry
Copy link
Contributor

bgentry commented Sep 26, 2024

@sxwebdev I've found at least one bug here that's new to v0.12.0. While I've fixed that one locally, I'm working on additional test cases and making sure all edge cases are covered. Hope to have something up shortly.

@sxwebdev
Copy link
Author

@bgentry thank you, waiting for the release

@bgentry
Copy link
Contributor

bgentry commented Sep 26, 2024

@sxwebdev I believe #619 should address the issue you ran into along with another one I found. Added missing coverage to ensure it's fixed and doesn't break again. I'll ship that shortly in a v0.12.1.

Really sorry about the issue here, thank you so much for reporting it.

@bgentry
Copy link
Contributor

bgentry commented Sep 26, 2024

@sxwebdev ok v0.12.1 should be live now (barring any of the annoying issues with go module proxy caching), can you give that a try and let me know if you see anything else fishy? Thank you again 🙏

@sxwebdev
Copy link
Author

@bgentry Hi. I just rolled back my changes.

Removed this:

func (s *Worker) InsertOpts() river.InsertOpts {
	return river.InsertOpts{
		UniqueOpts: river.UniqueOpts{
			ByArgs: true,
		},
	}
}

Returned this:

riverClient.InsertTx(ctx, dbTx,
	taskmanager.SomeArgs{
		Key: value,
	},
	&river.InsertOpts{
		UniqueOpts: river.UniqueOpts{
			ByArgs: true,
		},
		ScheduledAt: time.Now().Add(time.Second*30),
	},
)

And updated the river to 0.12.1

In other words, I did it as it was before.

Now everything works as before version 0.12. The problem is no longer observed, thanks for the promptness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants