{"action":"created","issue":{"url":"https://api.github.com/repos/HangfireIO/Hangfire/issues/1184","repository_url":"https://api.github.com/repos/HangfireIO/Hangfire","labels_url":"https://api.github.com/repos/HangfireIO/Hangfire/issues/1184/labels{/name}","comments_url":"https://api.github.com/repos/HangfireIO/Hangfire/issues/1184/comments","events_url":"https://api.github.com/repos/HangfireIO/Hangfire/issues/1184/events","html_url":"https://github.com/HangfireIO/Hangfire/issues/1184","id":324080635,"node_id":"MDU6SXNzdWUzMjQwODA2MzU=","number":1184,"title":"sqlException during Background job creation.","user":{"login":"tamirfad","id":8993475,"node_id":"MDQ6VXNlcjg5OTM0NzU=","avatar_url":"https://avatars3.githubusercontent.com/u/8993475?v=4","gravatar_id":"","url":"https://api.github.com/users/tamirfad","html_url":"https://github.com/tamirfad","followers_url":"https://api.github.com/users/tamirfad/followers","following_url":"https://api.github.com/users/tamirfad/following{/other_user}","gists_url":"https://api.github.com/users/tamirfad/gists{/gist_id}","starred_url":"https://api.github.com/users/tamirfad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamirfad/subscriptions","organizations_url":"https://api.github.com/users/tamirfad/orgs","repos_url":"https://api.github.com/users/tamirfad/repos","events_url":"https://api.github.com/users/tamirfad/events{/privacy}","received_events_url":"https://api.github.com/users/tamirfad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-17T15:43:54Z","updated_at":"2018-05-31T23:00:27Z","closed_at":null,"author_association":"NONE","body":"Good day,\r\n\r\nWhen trying to insert new background job using the BackgroundJobClient I got the following Exception :\r\n\r\n```\r\nHangfire.BackgroundJobClientException: Background job creation failed. See inner exception for details. ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_HangFire_JobParameter'. Cannot insert duplicate key in object 'HangFire.JobParameter'. The duplicate key value is (370).\r\nThe statement has been terminated.\r\n   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)\r\n   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)\r\n   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)\r\n   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)\r\n   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()\r\n   at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command)\r\n   at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType)\r\n   at Hangfire.SqlServer.SqlServerConnection.<>c__DisplayClass5_0.<CreateExpiredJob>b__0(DbConnection connection)\r\n   at Hangfire.SqlServer.SqlServerStorage.UseConnection[T](Func`2 func)\r\n   at Hangfire.SqlServer.SqlServerConnection.CreateExpiredJob(Job job, IDictionary`2 parameters, DateTime createdAt, TimeSpan expireIn)\r\n   at Hangfire.Client.CoreBackgroundJobFactory.Create(CreateContext context)\r\n   at Hangfire.Client.BackgroundJobFactory.<>c__DisplayClass7_0.<CreateWithFilters>b__0()\r\n   at Hangfire.Client.BackgroundJobFactory.InvokeClientFilter(IClientFilter filter, CreatingContext preContext, Func`1 continuation)\r\n   at Hangfire.Client.BackgroundJobFactory.Create(CreateContext context)\r\n   at Hangfire.BackgroundJobClient.Create(Job job, IState state)\r\n   --- End of inner exception stack trace ---\r\n   at Hangfire.BackgroundJobClient.Create(Job job, IState state)\r\n   at Application.FileManagerAppService.<ReconFinishedAsync>d__dc.MoveNext() in c:\\Software\\Jenkins\\Host_build\\Application\\FileManagerAppService.cs:line 943\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Adapters.Recon.MessageHandlers.ReconFinishedNotificationHandler.<Handle>d__0.MoveNext() in c:\\Software\\Jenkins\\Host_build\\Adapters.Recon\\MessageHandlers\\ReconFinishedNotificationHandler.cs:line 35\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__1(Object state)\r\n   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()\r\n   at System.Threading.ThreadPoolWorkQueue.Dispatch()`\r\n```\r\n\r\nIt's Hangfire version 1.6.15. This exception occurs only one time.\r\n\r\nWhat can be the reason?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/HangfireIO/Hangfire/issues/comments/393709052","html_url":"https://github.com/HangfireIO/Hangfire/issues/1184#issuecomment-393709052","issue_url":"https://api.github.com/repos/HangfireIO/Hangfire/issues/1184","id":393709052,"node_id":"MDEyOklzc3VlQ29tbWVudDM5MzcwOTA1Mg==","user":{"login":"pieceofsummer","id":2262364,"node_id":"MDQ6VXNlcjIyNjIzNjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2262364?v=4","gravatar_id":"","url":"https://api.github.com/users/pieceofsummer","html_url":"https://github.com/pieceofsummer","followers_url":"https://api.github.com/users/pieceofsummer/followers","following_url":"https://api.github.com/users/pieceofsummer/following{/other_user}","gists_url":"https://api.github.com/users/pieceofsummer/gists{/gist_id}","starred_url":"https://api.github.com/users/pieceofsummer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pieceofsummer/subscriptions","organizations_url":"https://api.github.com/users/pieceofsummer/orgs","repos_url":"https://api.github.com/users/pieceofsummer/repos","events_url":"https://api.github.com/users/pieceofsummer/events{/privacy}","received_events_url":"https://api.github.com/users/pieceofsummer/received_events","type":"User","site_admin":false},"created_at":"2018-05-31T23:00:27Z","updated_at":"2018-05-31T23:00:27Z","author_association":"CONTRIBUTOR","body":"This is pretty odd. `PK_HangFire_JobParameter` is for identity column `Id`, hence there shouldn't be any duplicate key issues with it (unless something has messed up with identity counter value for the table, probably some database maintenance or backup/restore script).\r\n\r\nSince it only happened once, I'm inclined to think the table contained some invalid data."}}
{"actor":{"display_login":"pieceofsummer"}}