Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Z-Push sync breaks when a message has improperly declared encoding #130

Open
tylerapplebaum opened this issue Jan 14, 2025 · 1 comment
Open

Comments

@tylerapplebaum
Copy link

Describe the bug
I had a folder with a message from eBay that would not sync. New messages could not be downloaded for this particular folder, and other message downloading would break for a period of time. This error was repeated in the logs when syncing this folder was attempted.

13/01/2025 07:56:32 [1487379] [ERROR] [[email protected]] LoopDetection->ProcessLoopDetectionPreviousConnectionFailed(): Command 'Sync' at 13/01/2025 07:01:44 with pid '1480052' terminated unexpectedly or is still running.
13/01/2025 07:56:32 [1487379] [ERROR] [[email protected]] Please check your logs for this PID and errors like PHP-Fatals or Apache segmentation faults and report your results to the Z-Push dev team.
13/01/2025 10:05:36 [1504137] [WARN] [[email protected]] Mobile loop detected! Messages sent to the mobile will be restricted to 2 items in order to identify the conflict
13/01/2025 10:05:36 [1504137] [ERROR] [[email protected]] Ignored broken message (SyncMail). Reason: '2' Folderid: 'i/cd5dbd26' message id '8775'
13/01/2025 10:05:36 [1504137] [FATAL] [[email protected]] Fatal error: /usr/local/lib/z-push/lib/core/streamer.php:309 - Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, array given in /usr/local/lib/z-push/lib/core/streamer.php:309
Stack trace:
#0 /usr/local/lib/z-push/lib/core/streamimporter.php(171): Streamer->Encode()
#1 /usr/local/lib/z-push/lib/default/diffbackend/exportchangesdiff.php(167): ImportChangesStream->ImportMessageChange()
#2 /usr/local/lib/z-push/lib/request/sync.php(1199): ExportChangesDiff->Synchronize()
#3 /usr/local/lib/z-push/lib/request/sync.php(956): Sync->syncFolder()
#4 /usr/local/lib/z-push/lib/request/requestprocessor.php(116): Sync->Handle()
#5 /usr/local/lib/z-push/index.php(107): RequestProcessor::HandleRequest()
#6 {main}
  thrown (1)

The following commands did not resolve the issue:

ubuntu@mail01:~$ sudo /usr/local/lib/z-push/z-push-admin.php -a clearloop

System wide loop detection data removed: OK

ubuntu@mail01:~$ sudo /usr/local/lib/z-push/z-push-admin.php -a fixstates

Validating and fixing states (this can take some time):
	11:58:47 Checking username casings: Processed: 1 - Converted: 0 - Removed: 0
	11:58:47 Checking available devicedata & user linking: Processed: 1 - Fixed: 0
	11:58:47 Checking for unreferenced (obsolete) state files: Processed: 84 - Deleted: 0
	11:58:47 Checking for hierarchy folder data state: Devices: 1 - Processed: 1 - Fixed: 0 - Device+User without hierarchy: 0
	11:58:47 Checking flags of shared folders: Devices: 1 - Devices with additional folders: 0 - Fixed: 0

I was suspicious that a particular message was causing this issue, and deleted it. Sync began to work after that. The message in question had a typo in the character encoding declaration. The charset is supposed to be utf-8, obviously

<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8=
">
  </head>
<...snip...>

To Reproduce
Steps to reproduce the behavior:

  1. Receive a message with malformed character encoding
  2. Attempt to sync the folder that the message belongs to
  3. See error

Expected behavior
Maybe this is more of a feature request, but it would be nice to attempt to force utf-8 encoding if the character encoding can't be parsed.

Logs
See above

Server (please complete the following information):

  • OS: Ubuntu 22.04.5 LTS
  • PHP Version: 8.0.30
  • Backend for: Mail-in-a-Box
  • and Version: v70

Smartphone (please complete the following information):

  • Device: iPhone 15 Pro
  • OS: iOS 18.2, iOS 18.2.1
  • Mail App Apple Mail

Additional context
I use Geary 46 on Ubuntu as my desktop mail client, and it did not have a problem syncing or displaying this message at all.

@matidau
Copy link
Collaborator

matidau commented Jan 15, 2025

Thanks for logging this.

The error message points to a php 8 syntax issue related to a bit of code handling attachments.

Will fix this up for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants