- ABP Framework version: 5.2.1
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace: N/A
- Steps to reproduce the issue:"
Create a new app-nolayers-pro solution. Add dependies and depends on related modules
// Hangfire Background worker
typeof(AbpBackgroundWorkersHangfireModule),
// Hangfire background jobs
typeof(AbpBackgroundJobsModule),
typeof(AbpBackgroundJobsHangfireModule)
private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddHangfire(config =>
{
config.UseSqlServerStorage(configuration.GetConnectionString("Default"));
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
..... other confs
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter() }
});
.... also register background workers
await context.AddBackgroundWorkerAsync<worker1>();
await context.AddBackgroundWorkerAsync<worker2>();
}
Start up the app. it works. queue some jobs. Your yourproject.hangfire.job table should have stuff in it now
Stop app, next time application attempts startup, it just hangs, no errors. If you DELETE FROM hangfire.job table and start up app, it starts...
7 Answer(s)
-
0
Hi
Can you share the full steps to reproduce? thanks.
-
0
Shared via mail, thanks
-
0
-
0
Hi Liang,
Yes the recurring worker jobs are okay, in my sample i triggered queued for processing various non-recurring worker jobs that take TransactionProcessingArgs. You can see in the screenshots above, maybe trigger a bunch of these. You should get failures since you dont have keys to use the domain service and these will end up in retry states. Stop the application and try again? Any time I have jobs in the hangfire.jobs table it wouldnt start back up
-
0
-
0
Hi,
Here are my steps, there is no problem.
public class MyArgs { public string Name { get; set; } public MyArgs() { } } public class MyJob : AsyncBackgroundJob<MyArgs>, ITransientDependency { public override async Task ExecuteAsync(MyArgs args) { await Task.Delay(5000); Logger.LogInformation("MyJob.................."); } } var jobManager= context.ServiceProvider.GetRequiredService<IBackgroundJobManager>(); for (var i = 0; i < 50; i++) { await jobManager.EnqueueAsync(new MyArgs()); }
-
0
The issue turned out to be use of async via AsyncHelper.RunSync in a singleton constructor: my bad.
Thanks!