-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
[BUG] Can not find variable 3 in stack #645
Comments
I'm unable to reproduce this (both with the latest version and the v4.0.10). I tried with the test below: @Test
void testViaWrapper() {
TestService.Work myWork = new TestService.Work(5, "my string", UUID.randomUUID());
testWithMethod(myWork);
}
void testWithMethod(TestService.Work work) {
TestService newTestService = new TestService();
int workCount = work.getWorkCount();
JobId jobId = JobRunrWrapper.enqueue(() -> newTestService.doWork(workCount, work));
await().atMost(30, SECONDS).until(() -> storageProvider.getJobById(jobId).hasState(SUCCEEDED));
}
public static class JobRunrWrapper {
public static JobId enqueue(JobLambda job) {
JobId jobId = BackgroundJob.enqueue(job);
System.out.println("Doing something with the JobId: " + jobId);
return jobId;
}
} Please create a Github repo reproducing this with the latest JobRunr version and then reopen this issue. |
I met the same problem in Kotlin. And this problem won't appear in tests, it only appear in running by bootRun. When the lambda captures a custom class/interface like the one below, it will work: jobScheduler.enqueue(null, {
fulfillFreightClientOrderJob.fulfillFreightClientOrder(
clientOrder.id!!, // interface IClientOrder
referenceFid,
)
}) But if only capture jobScheduler.enqueue(null, {
fulfillFreightClientOrderJob.fulfillFreightClientOrder(
clientOrderId, // Long
referenceFid, // String
)
}) |
I'm still unable to reproduce it: @Test
void testIssue645() {
TestService.GithubIssue645 githubIssue645 = new TestService.GithubIssue645();
JobId jobId = BackgroundJob.enqueue(() -> testService.doWorkForIssue645(githubIssue645.getId(), githubIssue645));
await().atMost(30, SECONDS).until(() -> storageProvider.getJobById(jobId).hasState(SUCCEEDED));
} where GithubIssue645 public static class GithubIssue645 {
private Long id;
public GithubIssue645() {
this.id = 2L;
}
public Long getId() {
return id;
}
} And TestService: public void doWorkForIssue645(Long id, GithubIssue645 someObject) {
System.out.println("Doing work for github issue 645 " + id.toString() + "; " + someObject);
} @vergilchoi : could you setup a reproducible Github Repo? |
Hi @rdehuyss , just wondering if you have checked the repo and figured out the problem? |
Hi @vergilchoi - I'm really sorry but not yet. Some things came up but please know that it is definitely still on my todo list. |
Thx for the reproducible scenario, I was able to reproduce it. Looking into it. |
The cause was found and a fix was implemented. Thanks @vergilchoi to provide a working reproducible scenario - these kind of things really help! |
JobRunr Version
4.0.10
JDK Version
1.8.0_342
Your SQL / NoSQL database
MySQL 8
What happened?
we recently changed the signature of an enqueue task, and are now receiving shouldNotHappenException claiming "Can not find variable 3 in stack"
we have rebooted the server and the issue continues to occur
How to reproduce?
original code:
new code:
for reference, JobRunrConfig utility class
Relevant log output
The text was updated successfully, but these errors were encountered: