Page MenuHomePhabricator

PhabricatorApplicationTransactionPublishWorker task failing due to malformed UTF-8
Closed, DuplicatePublic

Description

Repro steps:

  • have old legacy project (probably with lots of badly-encoded files)
  • In Phabricator UI, go to the daemon console.

Expected behaviour

No failing tasks.

Actual behaviour:

300216	PhabricatorApplicationTransactionPublishWorker	19667:1460621233:f65e27c19886:294	29 s	1000	789
error.log
2016-04-14_08:02:14.23751 [14-Apr-2016 09:02:14 Europe/London] [2016-04-14 09:02:14] EXCEPTION: (PhutilProxyException) Error while executing Task ID 300216. {>} (Exception) Failed to JSON encode value (#5: Malformed UTF-8 characters, possibly incorrectly encoded): Dictionary value at key "attachments > 0 > data" is not valid UTF8, and cannot be JSON encoded: diff --git x/xxxxx/xxx/xxxxxxxxxx.xxx x/xxxxx/xxx/xxxxxxxxxx.xxx
2016-04-14_08:02:14.23756 index 4293306..c1b7d19 100644
2016-04-14_08:02:14.23757 --- xxxxxxxxxxxxxxxxxxxxxxxxxx
2016-04-14_08:02:14.23758 +++ xxxxxxxxxxxxxxxxxxxxxxxxxx
2016-04-14_08:02:14.23759 @@ -12,7 +12,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2016-04-14_08:02:14.23761  xxxxxxxxxxxxxxxxxxxxxxxx
2016-04-14_08:02:14.23761  xxxxxxxx. at [<phutil>/src/utils/utils.php:1164]
2016-04-14_08:02:14.23810 [14-Apr-2016 09:02:14 Europe/London] arcanist(head=f89f3de65805f7f65c8082ed387e8e2572596f7a, ref.master=8701e6c1f31a), phabricator(head=fea2389066edf3ad0a7547ae12d8e988428a4f5c, ref.master=fa6151778fe8), phutil(head=d414e4436e1c8779634458c23ab8880cf613312f, ref.master=3024f0a4908b)
2016-04-14_08:02:14.23812 [14-Apr-2016 09:02:14 Europe/London]   #0 <#2> phutil_json_encode(array) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1654]
2016-04-14_08:02:14.23816 [14-Apr-2016 09:02:14 Europe/London]   #1 <#2> LiskDAO::applyLiskDataSerialization(array, boolean) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1357]
2016-04-14_08:02:14.23817 [14-Apr-2016 09:02:14 Europe/London]   #2 <#2> LiskDAO::willWriteData(array) called at [<phabricator>/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php:240]
2016-04-14_08:02:14.23818 [14-Apr-2016 09:02:14 Europe/London]   #3 <#2> PhabricatorLiskDAO::willWriteData(array) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1232]
2016-04-14_08:02:14.23820 [14-Apr-2016 09:02:14 Europe/London]   #4 <#2> LiskDAO::insertRecordIntoDatabase(string) called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1106]
2016-04-14_08:02:14.23823 [14-Apr-2016 09:02:14 Europe/London]   #5 <#2> LiskDAO::insert() called at [<phabricator>/src/infrastructure/storage/lisk/LiskDAO.php:1075]
2016-04-14_08:02:14.23824 [14-Apr-2016 09:02:14 Europe/London]   #6 <#2> LiskDAO::save() called at [<phabricator>/src/applications/metamta/storage/PhabricatorMetaMTAMail.php:382]
2016-04-14_08:02:14.23825 [14-Apr-2016 09:02:14 Europe/London]   #7 <#2> PhabricatorMetaMTAMail::save() called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1116]
2016-04-14_08:02:14.23826 [14-Apr-2016 09:02:14 Europe/London]   #8 <#2> PhabricatorApplicationTransactionEditor::publishTransactions(PhabricatorRepositoryCommit, array) called at [<phabricator>/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php:21]
2016-04-14_08:02:14.23828 [14-Apr-2016 09:02:14 Europe/London]   #9 <#2> PhabricatorApplicationTransactionPublishWorker::doWork() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorWorker.php:122]
2016-04-14_08:02:14.23830 [14-Apr-2016 09:02:14 Europe/London]   #10 <#2> PhabricatorWorker::executeTask() called at [<phabricator>/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php:171]
2016-04-14_08:02:14.23832 [14-Apr-2016 09:02:14 Europe/London]   #11 <#2> PhabricatorWorkerActiveTask::executeTask() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php:22]
2016-04-14_08:02:14.23833 [14-Apr-2016 09:02:14 Europe/London]   #12 PhabricatorTaskmasterDaemon::run() called at [<phutil>/src/daemon/PhutilDaemon.php:183]
2016-04-14_08:02:14.23834 [14-Apr-2016 09:02:14 Europe/London]   #13 PhutilDaemon::execute() called at [<phutil>/scripts/daemon/exec/exec_daemon.php:125]
2016-04-14_08:02:14.24119 [14-Apr-2016 09:02:14 Europe/London] PHP Fatal error:  Uncaught exception 'Exception' with message 'Process exited with an open transaction! The transaction will be implicitly rolled back. Calls to openTransaction() must always be paired with a call to saveTransaction() or killTransaction().' in /srv/phabricator/libphutil/src/aphront/storage/connection/AphrontDatabaseTransactionState.php:78
2016-04-14_08:02:14.24121 Stack trace:
2016-04-14_08:02:14.24123 #0 [internal function]: AphrontDatabaseTransactionState->__destruct()
2016-04-14_08:02:14.24124 #1 {main}
2016-04-14_08:02:14.24125   thrown in /srv/phabricator/libphutil/src/aphront/storage/connection/AphrontDatabaseTransactionState.php on line 78

Version info

CentOS 7.2.1511
Git 1.8.3.1
PHP 5.6.17

phabricator fea2389066edf3ad0a7547ae12d8e988428a4f5c (Sat, Apr 2)
arcanist f89f3de65805f7f65c8082ed387e8e2572596f7a (Sat, Mar 19)
phutil d414e4436e1c8779634458c23ab8880cf613312f (Sat, Apr 2)

Event Timeline

have old legacy project (probably with lots of badly-encoded files)

This isn't a set of reproduction steps that I can follow unfortunately. Nothing in your error log seems related to projects. Do you have a set of reproducible steps we can follow to see this error? Basically from a clean install, I should be able to follow your steps precisely and encounter the same error. Without steps to reproduce an error, we have no idea if we're fixing your error or just making random guesses. The log provided above gives no smoking gun details.

This is related to JSON not supporting other character sets than UTF-8. It's a known issue (let me see if I can find the task).

Here's the official upstream task: T5955. Here's another report of the same issue: T7260.

(@chad you might want to just merge this into T5955 instead of me adding a blocking task, I wasn't sure and figured adding a blocking task was the least destructive thing to do)

I have a mental scarmemory of this exception because there was a period there where I had to be manually cancelling tasks every week to clear broken commit imports out of the queue so the builds would run :3