Closed alimosabebishift closed 2 years ago
Thanks for all the details, the problem is really strange. Could you issue the following query to your SQL Server with actual job identifier to see the actual payload?
SELECT * FROM [HangFire].[Job] WHERE [Id] = <JOBID>
yeah , something like this
Scheduled job
Id 7451 StatId 14981 StateName Scheduled
InvocationData {"t":"Quorum4.Helpers.HangFireHelper, Quorum4","m":"SendReminderEmail","p":["System.String","System.Int32","System.String"]}
Arguments ["\"<!DOCTYPE html PUBLIC \\"-//W3C//DTD XHTML 1.0 Strict//EN\\" \\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\\"> \r\n<html xmlns=\\"http://www.w3.org/1999/xhtml\\\">\\r\\n
\r\n\t<meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=utf-8\\" />\r\n\t<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\"/>\r\n\t
I have an issue with Hangfire , having both recurring and scheduled, Recurring jobs are okay and processing without any issue but I see none of Scheduled jobs going to processing state and I see it shows Enqueue 1 day ago, 30 mins ago,...... (apparently something is wrong with serialization but I cant find what) I had this log with older version
2020-10-13 00:01:51,074 [DelayedJobScheduler] ERROR Hangfire.Server.DelayedJobScheduler [LogException] - Error occurred during execution of 'DelayedJobScheduler' process. Execution will be retried (attempt #104) in 00:05:00 seconds. Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: . Path 'Arguments', line 6, position 3. at Newtonsoft.Json.JsonTextReader.ParsePostValue(Boolean ignoreComments) at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructorb__0(IStorageConnection connection)
at Hangfire.Server.DelayedJobScheduler.UseConnectionDistributedLock[T](JobStorage storage, Func`2 action)
at Hangfire.Server.DelayedJobScheduler.Execute(BackgroundProcessContext context)
at Hangfire.Server.AutomaticRetryProcess.Execute(BackgroundProcessContext context)
1 creator, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Hangfire.Common.JobHelper.FromJson[T](String value) at Hangfire.SqlServer.SqlServerConnection.<>c__DisplayClass8_0.<GetJobData>b__0(DbConnection connection) at Hangfire.SqlServer.SqlServerStorage.UseConnection[T](DbConnection dedicatedConnection, Func
2 func) at Hangfire.SqlServer.SqlServerConnection.GetJobData(String id) at Hangfire.States.BackgroundJobStateChanger.GetJobData(StateChangeContext context) at Hangfire.States.BackgroundJobStateChanger.ChangeState(StateChangeContext context) at Hangfire.Server.DelayedJobScheduler.<>c__DisplayClass10_0.and I updated to new version to see if this fix the issue GetHangfireServers()
{
GlobalConfiguration.Configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSqlServerStorage("HangFireServer", new SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero,
UseRecommendedIsolationLevel = true,
PrepareSchemaIfNecessary = true, // Default value: true
EnableHeavyMigrations = true // Default value: false
//DisableGlobalLocks = true
});
yield return new BackgroundJobServer();
}
app.UseHangfireAspNet(GetHangfireServers);
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new[] { new HangFireAuthorizationFilter() }
});
here is my setup private IEnumerable
but still getting this in logs,
2020-10-23 00:02:34,922 [DelayedJobScheduler #1] ERROR Hangfire.Server.DelayedJobScheduler [LogException] - 5 state change attempt(s) failed due to an exception, moving job to the FailedState Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: . Path 'Arguments', line 6, position 3. at Newtonsoft.Json.JsonTextReader.ParsePostValue(Boolean ignoreComments) at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor
1 creator, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Hangfire.Common.SerializationHelper.Deserialize(String value, Type type, SerializationOption option) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Hangfire.Common.SerializationHelper.Deserialize(String value, Type type, SerializationOption option) at Hangfire.Common.SerializationHelper.Deserialize[T](String value, SerializationOption option) at Hangfire.Common.SerializationHelper.Deserialize[T](String value) at Hangfire.Storage.InvocationData.DeserializePayload(String payload) at Hangfire.SqlServer.SqlServerConnection.<>c__DisplayClass8_0.<GetJobData>b__0(DbConnection connection) at Hangfire.SqlServer.SqlServerStorage.UseConnection[T](DbConnection dedicatedConnection, Func
2 func) at Hangfire.States.BackgroundJobStateChanger.GetJobData(StateChangeContext context) at Hangfire.States.BackgroundJobStateChanger.ChangeState(StateChangeContext context) at Hangfire.Server.DelayedJobScheduler.EnqueueBackgroundJob(BackgroundProcessContext context, IStorageConnection connection, String jobId)anyone ever had this issue? is there anyway to fix this without deleting all scheduled jobs? Thanks