Details
-
Bug
-
Resolution: Fixed
-
High
-
7.0.0, 7.13.18, 8.5.11, 8.13.3
-
7
-
28
-
Severity 1 - Critical
-
11
-
Description
NOTE: This bug report is for JIRA Server. Using JIRA Cloud? 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:
Caesium-1-2 WARN anonymous my-mail-handler [c.a.mail.incoming.mailfetcherservice] my-mail-handler[10101]: Unable to create issue with message. 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,.453][timespent,null][timeoriginalestimate,null][project,10000][description,Test. Some NULL values ahead:end of message][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,.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 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".)) at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:546) at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssueObject(DefaultIssueManager.java:635) at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssueWithIssueManager(DefaultMessageHandlerContext.java:248) at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssue(DefaultMessageHandlerContext.java:166) at com.atlassian.jira.service.services.mail.DelegatingMessageHandlerContext.createIssue(DelegatingMessageHandlerContext.java:43) at com.atlassian.jira.plugins.mail.handlers.CreateIssueHandler.handleMessage(CreateIssueHandler.java:265) at com.atlassian.jira.plugins.mail.handlers.CreateOrCommentHandler.handleMessage(CreateOrCommentHandler.java:133) at com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:381) at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:260) at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:371) at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:229) at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61) at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62) at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44) at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32) at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153) at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118) at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:453) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:447) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:394) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:279) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:275) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:78) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:70) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:40) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.jira.workflow.WorkflowException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Issue][summary,Hello!][watches,0][creator,testuser][created,.453][timespent,null][timeoriginalestimate,null][project,10000][description,Test. Some NULL values ahead:end of message][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,.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 ][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,.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 .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".)) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172) at com.atlassian.jira.entity.EntityUtils.createValue(EntityUtils.java:35) at com.atlassian.jira.issue.IssueImpl.store(IssueImpl.java:1150) at com.atlassian.jira.workflow.function.issue.IssueCreateFunction.execute(IssueCreateFunction.java:69) at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1050) at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1446) at com.opensymphony.workflow.AbstractWorkflow.initialize(AbstractWorkflow.java:615) at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:741) ... 27 more Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Issue][summary,Hello!][watches,0][creator,testuser][created,.453][timespent,null][timeoriginalestimate,null][project,10000][description,Test. Some NULL values ahead:end of message .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,.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 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".)) at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:214) at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:179) at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83) at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:542) at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:97) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296) ... 35 more 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 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".) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:686) at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:206) ... 41 more Caused by: org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1810) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:332) at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:676) ... 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:
- Create a JIRA mail handler
- 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
Note on fix
We introduced the filter to sanitize the message body during email processing by Jira Mail handler (com.atlassian.jira.plugins.mail.handlers.CreateOrCommentHandler):
public static String sanitizeText(@Nullable String text) { if (text == null) { return null; } return text.replace("\0", ""); }
Generally speaking, the error/exception comes OfBiz code when it's not being able to handle the malformed data (see JRASERVER-72673). We expect the code creating/adding issues will sanitize the data and call OfBiz with valid parameters.
That being said, they could be other problems with the same symptom caused by 3rd party Apps.
Attachments
Issue Links
- causes
-
JRACLOUD-66153 JIRA increments pcounter when UTF encoding errors occurs
- Closed
- is caused by
-
JRASERVER-72673 OfBiz library doesn't handle NUL characters correctly
- Gathering Impact
- is duplicated by
-
JRACLOUD-66153 JIRA increments pcounter when UTF encoding errors occurs
- Closed
- is related to
-
JSDSERVER-10922 Jira Service Management Mail Handler error "invalid byte sequence for encoding "UTF8": 0x00" prevents issue creation by email when Postgres database is used
- Closed
- relates to
-
JRACLOUD-59061 ERROR: invalid byte sequence for encoding "UTF8": 0x00 prevents creation of issues by email
- Closed
-
RAID-2328 Loading...