Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JRACLOUD-59061

ERROR: invalid byte sequence for encoding "UTF8": 0x00 prevents creation of issues by email

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Cloud. Using JIRA Server? See the corresponding bug report.

      When JIRA Mail handler tries to insert in the database an email that contains the character 0x00 NUL the issue will not be created and the following error will keep cycling every 1 minute:

      2015-12-18 10:26:30.460552500 2015-12-18 10:26:30,458 Caesium-1-2 WARN anonymous    my-mail-handler [c.a.mail.incoming.mailfetcherservice] my-mail-handler[10101]: Unable to create issue with message.
      2015-12-18 10:26:30.460553500 com.atlassian.jira.exception.CreateException: com.atlassian.jira.workflow.WorkflowException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Issue][summary,Hello!][watches,0][creator,testuser][created,2015-12-18 10:26:30.453][timespent,null][timeoriginalestimate,null][project,10000][description,Test. Some NULL values ahead:end of message
      2015-12-18 10:26:30.460736500 ][reporter,testuser][type,3][priority,3][number,311][environment,null][security,null][timeestimate,null][duedate,null][resolutiondate,null][votes,0][assignee,sysadmin][id,17907][updated,2015-12-18 10:26:30.453][workflowId,17907][status,1] (SQL Exception while executing the following:INSERT INTO public.jiraissue (ID, pkey, issuenum, PROJECT, REPORTER, ASSIGNEE, CREATOR, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, RESOLUTIONDATE, VOTES, WATCHES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00
      2015-12-18 10:26:30.460827500   Hint: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".))
      2015-12-18 10:26:30.460828500 	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:546)
      2015-12-18 10:26:30.460829500 	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssueObject(DefaultIssueManager.java:635)
      2015-12-18 10:26:30.460830500 	at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssueWithIssueManager(DefaultMessageHandlerContext.java:248)
      2015-12-18 10:26:30.460875500 	at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssue(DefaultMessageHandlerContext.java:166)
      2015-12-18 10:26:30.460876500 	at com.atlassian.jira.service.services.mail.DelegatingMessageHandlerContext.createIssue(DelegatingMessageHandlerContext.java:43)
      2015-12-18 10:26:30.460877500 	at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.handleMessage(CreateIssueHandler.java:265)
      2015-12-18 10:26:30.460918500 	at com.atlassian.jira.plugins.mail.handlers.CreateOrCommentHandler.handleMessage(CreateOrCommentHandler.java:133)
      2015-12-18 10:26:30.460919500 	at com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:381)
      2015-12-18 10:26:30.460919500 	at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:260)
      2015-12-18 10:26:30.460960500 	at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:371)
      2015-12-18 10:26:30.460960500 	at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:229)
      2015-12-18 10:26:30.460961500 	at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61)
      2015-12-18 10:26:30.461000500 	at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62)
      2015-12-18 10:26:30.461000500 	at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44)
      2015-12-18 10:26:30.461001500 	at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32)
      2015-12-18 10:26:30.461001500 	at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153)
      2015-12-18 10:26:30.461042500 	at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118)
      2015-12-18 10:26:30.461042500 	at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97)
      2015-12-18 10:26:30.461043500 	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:453)
      2015-12-18 10:26:30.461044500 	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:447)
      2015-12-18 10:26:30.461083500 	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:394)
      2015-12-18 10:26:30.461083500 	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:279)
      2015-12-18 10:26:30.461084500 	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:275)
      2015-12-18 10:26:30.461123500 	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:78)
      2015-12-18 10:26:30.461124500 	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:70)
      2015-12-18 10:26:30.461124500 	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:40)
      2015-12-18 10:26:30.461164500 	at java.lang.Thread.run(Thread.java:745)
      2015-12-18 10:26:30.461165500 Caused by: com.atlassian.jira.workflow.WorkflowException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Issue][summary,Hello!][watches,0][creator,testuser][created,2015-12-18 10:26:30.453][timespent,null][timeoriginalestimate,null][project,10000][description,Test. Some NULL values ahead:end of message
      2015-12-18 10:26:30.461210500 ][reporter,testuser][type,3][priority,3][number,311][environment,null][security,null][timeestimate,null][duedate,null][resolutiondate,null][votes,0][assignee,sysadmin][id,17907][updated,2015-12-18 10:26:30.453][workflowId,17907][status,1] (SQL Exception while executing the following:INSERT INTO public.jiraissue (ID, pkey, issuenum, PROJECT, REPORTER, ASSIGNEE, CREATOR, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, RESOLUTIONDATE, VOTES, WATCHES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00
      2015-12-18 10:26:30.461303500   Hint: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".))
      2015-12-18 10:26:30.461304500 	at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:767)
      2015-12-18 10:26:30.461305500 	at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:537)
      2015-12-18 10:26:30.461305500 	... 26 more
      2015-12-18 10:26:30.461305500 ][reporter,testuser][type,3][priority,3][number,311][environment,null][security,null][timeestimate,null][duedate,null][resolutiondate,null][votes,0][assignee,sysadmin][id,17907][updated,2015-12-18 10:26:30.453][workflowId,17907][status,1] (SQL Exception while executing the following:INSERT INTO public.jiraissue (ID, pkey, issuenum, PROJECT, REPORTER, ASSIGNEE, CREATOR, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, RESOLUTIONDATE, VOTES, WATCHES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00
      2015-12-18 10:26:30.461391500   Hint: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".))
      2015-12-18 10:26:30.461392500 	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299)
      2015-12-18 10:26:30.461392500 	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)
      2015-12-18 10:26:30.461393500 	at com.atlassian.jira.entity.EntityUtils.createValue(EntityUtils.java:35)
      2015-12-18 10:26:30.461431500 	at com.atlassian.jira.issue.IssueImpl.store(IssueImpl.java:1150)
      2015-12-18 10:26:30.461432500 	at com.atlassian.jira.workflow.function.issue.IssueCreateFunction.execute(IssueCreateFunction.java:69)
      2015-12-18 10:26:30.461433500 	at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1050)
      2015-12-18 10:26:30.461433500 	at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1446)
      2015-12-18 10:26:30.461472500 	at com.opensymphony.workflow.AbstractWorkflow.initialize(AbstractWorkflow.java:615)
      2015-12-18 10:26:30.461512500 	at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:741)
      2015-12-18 10:26:30.461513500 	... 27 more
      2015-12-18 10:26:30.461513500 Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Issue][summary,Hello!][watches,0][creator,testuser][created,2015-12-18 10:26:30.453][timespent,null][timeoriginalestimate,null][project,10000][description,Test. Some NULL values ahead:end of message
      2015-12-18 10:26:30.461554500 ][reporter,testuser][type,3][priority,3][number,311][environment,null][security,null][timeestimate,null][duedate,null][resolutiondate,null][votes,0][assignee,sysadmin][id,17907][updated,2015-12-18 10:26:30.453][workflowId,17907][status,1] (SQL Exception while executing the following:INSERT INTO public.jiraissue (ID, pkey, issuenum, PROJECT, REPORTER, ASSIGNEE, CREATOR, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, RESOLUTIONDATE, VOTES, WATCHES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00
      2015-12-18 10:26:30.461635500   Hint: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".))
      2015-12-18 10:26:30.461636500 	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:214)
      2015-12-18 10:26:30.461637500 	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:179)
      2015-12-18 10:26:30.461637500 	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83)
      2015-12-18 10:26:30.461638500 	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:542)
      2015-12-18 10:26:30.461680500 	at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:97)
      2015-12-18 10:26:30.461681500 	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296)
      2015-12-18 10:26:30.461682500 	... 35 more
      2015-12-18 10:26:30.461682500 Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO public.jiraissue (ID, pkey, issuenum, PROJECT, REPORTER, ASSIGNEE, CREATOR, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, RESOLUTIONDATE, VOTES, WATCHES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00
      2015-12-18 10:26:30.461763500   Hint: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".)
      2015-12-18 10:26:30.461764500 	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:686)
      2015-12-18 10:26:30.461765500 	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:206)
      2015-12-18 10:26:30.461765500 	... 41 more
      2015-12-18 10:26:30.461766500 Caused by: org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00
      2015-12-18 10:26:30.461805500 	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077)
      2015-12-18 10:26:30.461805500 	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1810)
      2015-12-18 10:26:30.461806500 	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
      2015-12-18 10:26:30.461807500 	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498)
      2015-12-18 10:26:30.461848500 	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386)
      2015-12-18 10:26:30.461848500 	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:332)
      2015-12-18 10:26:30.461849500 	at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
      2015-12-18 10:26:30.461849500 	at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97)
      2015-12-18 10:26:30.461889500 	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:676)
      2015-12-18 10:26:30.461890500 	... 42 more
      

      Most email clients don't send the NUL character as they have no way for users to input this character in. This problem was found to happen when receiving Email Campaigns that are sent using scripts or programs.

      Environment:

      JIRA
      Postgres DB

      Steps to reproduce:

      1. Create a JIRA mail handler
      2. Send an email with the character NUL (0x00) as part of the Description
        Expected Result: JIRA corrects the NUL character unsupported by postgres and creates the issue normally
        Actual Result: JIRA fails to create the issue and keeps attempting to create it every 1 minute.

      This bug also causes: JRA-38024 - JIRA increments pcounter when UTF encoding errors occurs

      Attachments

        Issue Links

          Activity

            People

              rdelafuente@atlassian.com rupper
              mfernandezbadii Mauro Badii
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: