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

Since 6.19.0 I am not able to handle images and attached files #17

Open
doxioxi opened this issue Jun 12, 2023 · 37 comments
Open

Since 6.19.0 I am not able to handle images and attached files #17

doxioxi opened this issue Jun 12, 2023 · 37 comments

Comments

@doxioxi
Copy link

doxioxi commented Jun 12, 2023

Since 6.19.0 it is impossible for me to paste images or to see attached files on Signal Desktop under Debian 11 (bullseye).

When pasting a screenshot from the clipboard, the application rests in the loading-state. Clicking on the symbol for attaching files opens the file-browser and I am able to choose a file, but it never appears and the application is also resting in the loading-state to infinity (any file-type, it is not an issue with the preview of pictures). When receiving any attachment (any file-type) or a foto, I am not able to open it or to download it to the disk and pictures are not getting a preview.

244656397-c3aa11b2-7f92-4cdd-8c2b-c8e1e24fe12c

For the moment I hold the working version 6.18.1

debug log is here

I have already asked in the report box of the official build and I was told that something is going wrong at a very low level:

ERROR 2023-06-12T19:03:27.805Z Top-level unhandled promise rejection: Error: EFAULT: bad address in system call argument, write
ERROR 2023-06-12T19:05:04.482Z Top-level unhandled promise rejection: Error: EFAULT: bad address in system call argument, write
ERROR 2023-06-12T19:07:53.765Z Top-level unhandled promise rejection: Error: EFAULT: bad address in system call argument, write

The other inofficial arm64 build provided as a flatpak app shows exactly the same behaviour.

Any ideas?

Thanks in advance ;-)

@dennisameling
Copy link
Owner

dennisameling commented Jun 13, 2023

I just tried this with the latest release on Debian 11 arm64 through WSL (Windows Subsystem for Linux) and am not running into the issue you described. Could you please ensure that your OS is fully up to date, ensure that Signal has the correct read/write permissions and try again?

image

@doxioxi
Copy link
Author

doxioxi commented Jun 13, 2023

I can not confirm this. I tried the following: I took a fully fresh debian 12 image for my Raspberry Pi and only put the latest release and it shows exactly the same behaviour as under my everyday running fully updated debian 11 environment.

@bikinibabetpass
Copy link

I confirm this bug. Debian 12 ARM. @dennisameling please try running on native ARM linux.

@dennisameling
Copy link
Owner

Hmm, interesting. I currently don't have the bandwidth to look further into this, sorry. Maybe if you post in this issue, someone in there might be able to help debug this issue a bit further 🙏🏼

@doxioxi
Copy link
Author

doxioxi commented Aug 21, 2023

the last working version 6.18.1 for me reached end of life and I am forced to update. Is there any solution?

@dennisameling
Copy link
Owner

I haven't seen anyone come up with a solution yet, but the following questions might help someone who has the bandwidth to dive further into this:

  • Is this only happening on Debian 11 + 12 on arm64? Any other OSes that are facing the same issue?
  • What hardware are you running it on? As mentioned above, I couldn't reproduce on Windows 11 on arm64 with Debian 11 on a Surface Pro X. I see Raspberry Pi mentioned above - which model exactly?
  • I'm currently building Signal Desktop for Linux arm64 using CircleCI's ubuntu-2004 image (Ubuntu 20.04 LTS). Not sure if that could have any impact at all on this.
  • Have you looked at this issue already? It looks like some folks there were having similar issues.

@doxioxi
Copy link
Author

doxioxi commented Aug 26, 2023

The issue is solved for me. First I got it to work with ubuntu 22.04.3 LTS for Raspberry Pi, then also with the lastest image taken today from https://raspi.debian.net/daily-images/. So I think it's time to switch completely to debian 12 bookworm and there is no need to search why it did not work until now.

Thank you Dennis for insisting in trying to reproduce it on different OS images and moreover for providing here the arm64-version for the signal-desktop.... ;-)

@rovitotv
Copy link

rovitotv commented Oct 9, 2023

I have the same problem with a Raspberry Pi 4 on the lastest Raspberry Pi OS (Debian Bullseye version 11) with Signal Desktop Unofficial 6.33.0. The images don't resolve. I installed the Signal Desktop Unofficial deb package with the following command:

sudo apt install -f ./signal-desktop-unofficial_6.33.0_arm64.deb

here is output from neofetch:

       _,met$$$$$gg.          rovitotv@raspad 
    ,g$$$$$$$$$$$$$$$P.       --------------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 11 (bullseye) aarch64 
 ,$$P'              `$$$.     Host: Raspberry Pi 4 Model B Rev 1.5 
',$$P       ,ggs.     `$$b:   Kernel: 6.1.21-v8+ 
`d$$'     ,$P"'   .    $$$    Uptime: 7 hours, 25 mins 
 $$P      d$'     ,    $$P    Packages: 1724 (dpkg) 
 $$:      $$.   -    ,d$$'    Shell: bash 5.1.4 
 $$;      Y$b._   _,d$P'      Resolution: 1280x800, 1920x1080 
 Y$$.    `.`"Y$$$$P"'         DE: LXDE 
 `$$b      "-.__              WM: Mutter 
  `Y$$                        WM Theme: Adwaita 
   `Y$$.                      Theme: PiXflat [GTK3] 
     `$$b.                    Icons: PiXflat [GTK3] 
       `Y$$b.                 CPU: BCM2835 (4) @ 1.800GHz 
          `"Y$b._             Memory: 1999MiB / 7812MiB 

Despite this bug it is still a miracle this is working! Thank you so much.

@doxioxi
Copy link
Author

doxioxi commented Oct 14, 2023

With Debian Bullseye version 11 it was expectable but it's even worse: Same issue again with brand new Raspi OS released in Oct 2023 (based on Debian version 12 bookworm) together with signal-desktop-unofficial_6.34.0

OS: Debian GNU/Linux 12 (bookworm) aarch64
Host: Raspberry Pi 400 Rev 1.0
Kernel: 6.1.0-rpi4-rpi-v8

@yizeky
Copy link

yizeky commented Oct 29, 2023

I am facing the same issue in the linux container of the arm based Chromebook. I am also seeing 'EFAULT: bad address in system call argument, write' in the log.
Originally I was using the unofficial build for the arm. The issue still occurred even though it is built from source code (v6.36.0) on my linux container of the arm Chromebook.

When I run yarn test, test-electron was failing by the same EFAULT:

  • Attachments createReader should read file from disk
    Error: EFAULT: bad address in system call argument, write

  • Attachments copyIntoAttachmentsDirectory returns a function that copies the source path into the attachments directory and returns its path and size
    Error: EFAULT: bad address in system call argument, write

  • Attachments createWriterForExisting should write file to disk on given path and return path
    Error: EFAULT: bad address in system call argument, write

  • Attachments createWriterForNew should write file to disk and return path
    Error: EFAULT: bad address in system call argument, write

  • Attachments createDeleter should delete file from disk
    Error: EFAULT: bad address in system call argument, write

Is this electron related issue on the arm?

Additionally I confirmed by strace command to check which write systemcall is failing:
(Error message is Japanese)
..(snip)..
[pid 3540] write(66</home/user01/.config/Signal/badges.noindex/84/84e143bc387a605eab327145ada974a653b0df718716dea44eb600dc8ad7becf.svg>, "", 0 <unfinished ...>
[pid 3540] <... write resumed>) = -1 EFAULT (不正なアドレスです)
[pid 3537] write(67</home/user01/.config/Signal/badges.noindex/14/14e331ce7fc432a748edfb9eb8d4beb3b538bcab6ee78c7b3c1be11a0f79813e.svg>, "", 0 <unfinished ...>
[pid 3537] <... write resumed>) = -1 EFAULT (不正なアドレスです)
[pid 3538] write(66</home/user01/.config/Signal/badges.noindex/c5/c5e4a954260d0a0f87af8183a2eb1f7d4c55f3c7edfe12621db82628a16cd8bf.svg>, "", 0 <unfinished ...>
[pid 3538] <... write resumed>) = -1 EFAULT (不正なアドレスです)
[pid 3539] write(69</home/user01/.config/Signal/attachments.noindex/83/831057c29adaee8a3adf6fecbde0f7dfcc9ded303bbacd467226384dd6066cf0>, "", 0 <unfinished ...>
[pid 3539] <... write resumed>) = -1 EFAULT (不正なアドレスです)
[pid 3540] write(69</home/user01/.config/Signal/attachments.noindex/4f/4f0f6180ebf8432bbf37faed141e449fb1a96b093d7e1605a3eca0c7a156a79a>, "", 0 <unfinished ...>
[pid 3540] <... write resumed>) = -1 EFAULT (不正なアドレスです)

write systemcall for the files under .config/Signal/attachments.noindex and badges.noindex are failing by empty 2nd parameter with 0 byte count write e.g. write("xxx", "", 0); causes EFAULT.

========= System info =========
App version: 6.36.0
Environment: production
Linux version: "Debian GNU/Linux 11 (bullseye)"
Node version: 18.15.0
OS version: #1 SMP PREEMPT Fri Oct 13 18:24:10 PDT 2023
Time: 1698566202267
User agent: Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Signal/6.36.0 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36

@zylzyz
Copy link

zylzyz commented Nov 16, 2023

here is related conversation using arm64 architecture. scroll up and down.
https://forum.pine64.org/showthread.php?tid=18367&pid=120473#pid120473

@yizeky
Copy link

yizeky commented Nov 19, 2023

fse.ensureFile() call seems to be causing EFAULT of the write systemcall in arm64 environment.
I am not expert of node.js but I think:

  • ensureFile is implemented by fs-extra/lib/ensure/file.js as function createFile (file, callback)
  • createFile() is calling fs.write(file, '') in order to create empty file to target path.
  • fs.write() is dispatched to write() systemcall, but when 2nd parameter of fs.write() is empty (''), 2nd parameter of write systemcall is pointing invalid address.

My workaround:

  • Change fs.write(file, '') => fs.write(file, ' ') on node_modules/fs-extra/lib/ensure/file.js

Then now, I can send/receive attachments without EFAULT in my aarch64 chromebook linux.

I think root cause could be node.js or libuv? (somewhere dispatching to the write systemcall).
When empty buffer parameter passed to fs.WriteFile(), invalid const void *buf address is generated as the write() syscall parameter.

@zylzyz
Copy link

zylzyz commented Jan 25, 2024

this bug still occurs in 6.45.

filename:
signal-desktop-unofficial_6.45.0_arm64.deb
os:
mobian trixie, kernel, Linux mobian 6.6-sunxi64.
device:
pinephone regular.

@dennisameling dennisameling pinned this issue Feb 8, 2024
@Peter-lalala
Copy link

Some observations here:

  1. On Raspberry Pi4, NO issue with the Ubuntu 22.04.4 + Snap version (latest as of 2024.3.7)

  2. On Raspberry Pi4, same issue with PiOS/x11 (aarch64 bookworm) + Snap version (latest as of 2024.3.9)

  3. On Raspberry Pi4, same issue with PiOS/x11 (aarch64 bookworm) + Pi-Apps version 7.1.1

I guess #1 may provide some clues?

@CarstenKochElsdorf
Copy link

I am seeing the same bug on
Hardware: Orange Pi 5
Software: Ubuntu 22.04.3 LTS Jammy Jellyfish
Linux opim 5.10.110-rockchip-rk3588 #1.1.6 SMP Thu Jun 1 21:23:54 CST 2023 aarch64 aarch64 aarch64 GNU/Linux

Until yesterday I built signal-desktop myself (and was seeing the same bug), so I was looking forward to a better version when I downloaded https://github.com/dennisameling/Signal-Desktop
Quite disappointingly, the bug also exists here.

@doxioxi
Copy link
Author

doxioxi commented Jun 3, 2024

On Raspberry Pi5, NO issue with 2024-03-15-raspios-bookworm-arm64 + deb version 7.11.0

@dennisameling
Copy link
Owner

Hi all, I just published v7.24.0, which was built with Ubuntu 22.04 instead of 20.04 which I was using until today. Also, the Signal team has recently updated the NodeJS and Electron versions.

I'm curious if all these upgrades across the board make any difference for y'all.

If the issue still occurs, we might want to look into @yizeky's great investigative work. I noticed that Signal Desktop uses an almost 7 year old version of fs-extra, so if the bug is still present, I could try to upgrade it to the latest 11.2.0 in my fork (from 2023), or we might be able to come up with a small reproducer.

@doxioxi
Copy link
Author

doxioxi commented Sep 12, 2024

luckily continue with NO issue on my Raspberry Pi5 with updated 2024-03-15-raspios-bookworm-arm64 and the brand new deb version 7.24.0

@Peter-lalala
Copy link

Thanks for the new version. Still out of luck on my Raspberry Pi4 with latest Raspberry PiOS downloaded today (13 Sep 2024). Not tried on Pi4+Ubuntu this time though.

dennisameling added a commit to dennisameling/signal-desktop-automation that referenced this issue Sep 22, 2024
@dennisameling
Copy link
Owner

fse.ensureFile() call seems to be causing EFAULT of the write systemcall in arm64 environment. I am not expert of node.js but I think:

* ensureFile is implemented by fs-extra/lib/ensure/file.js as function createFile (file, callback)

* createFile() is calling fs.write(file, '') in order to create empty file to target path.

* fs.write() is dispatched to write() systemcall, but when 2nd parameter of fs.write() is empty (''), 2nd parameter of write systemcall is pointing invalid address.

My workaround:

* Change fs.write(file, '') => fs.write(file, ' ') on node_modules/fs-extra/lib/ensure/file.js

Then now, I can send/receive attachments without EFAULT in my aarch64 chromebook linux.

I think root cause could be node.js or libuv? (somewhere dispatching to the write systemcall). When empty buffer parameter passed to fs.WriteFile(), invalid const void *buf address is generated as the write() syscall parameter.

@yizeky thanks so much for taking the time to dive in and share your findings here!

I was able to reproduce the issue on a Raspberry Pi 4 with the latest Pi OS (based on Debian 12, kernel 6.6.47+rpt-rpi-v8). However, when I applied your changes, I ran into other errors instead:

Failed to decrypt attachment Error: error:1e00007b:Cipher functions:OPENSSL_internal:WRONG_FINAL_BLOCK_LENGTH

I assume that's because the file that would normally be empty, now contains a space, causing the decryption/encryption process to fail.

Instead, I updated the patch to simply ignore these errors on Linux arm64. That's because, strangely enough, the empty files do get created just fine on the filesystem in my testing. With this fix applied, I was able to successfully work with attachments on the Raspberry Pi 4 with Pi OS (Debian 12).

Here's the updated .deb artifact for 7.25.0 that includes the fix: https://github.com/dennisameling/Signal-Desktop/releases/tag/v7.25.0

I'd love to report this upstream, but am struggling to create a reproducer. Within Signal itself, the issue seems to start at AttachmentCrypto.ts which calls ensureFile from fs-extra as you mentioned. That method writes files into /home/dennis/.config/Signal Unofficial/downloads.noindex/LONG_RANDOM_KEY_HERE. The weird thing is that, as mentioned above, the files do get created despite the error popping up!

This minimal sample works fine on Node itself:

import pkg from 'fs-extra'
const {ensureFile} = pkg
import {open} from 'fs/promises'

let writeFd;
const path = "/home/dennis/.config/Signal Unofficial/downloads.noindex/aafa9baa4153fd5d91b9e7a5bc4b22f10a73d97f9291ef60b1cad6b860352c8f"
try {
    await ensureFile(path)
    writeFd = await open(path, 'w')
} catch (cause) {
    throw new Error('Failed to create write path', {cause})
}

If someone could help me come up with a minimal reproducer, that'd be amazing, so I can report it upstream.

@CarstenKochElsdorf
Copy link

I just tested your 7.25.0 on my Orange Pi 5 and I can confirm that it is working now. :-)

@yizeky
Copy link

yizeky commented Sep 25, 2024

@dennisameling -san, I confirmed the new v7.25.0, and it is working perfectly in my linux container (Deb 12) on the aarch64 chromebook, thank you very much for your update!

@yizeky
Copy link

yizeky commented Sep 25, 2024

Regarding minimal reproducer, I feel it might be caused by the write() systemcall on the Electron + node.js/libuv combination. I saw many of the EFAULT errors of the write() systemcall when I run 'yarn test-electron' in the Signal-Desktop source tree. So if it is possible to create a similar style (electron base?) of unit-test case which contains just ensureFile() call could be a candidate.

@Botspot
Copy link

Botspot commented Oct 16, 2024

This happened for the longest time for me, but it has been working reliably with the latest version for the past two weeks.

@bellegarde-c
Copy link

fs-extra patch is working but now, big emoji icons are broken:

First I launch Signal Desktop Unofficial, we see attached image but emoji are broken.
Then I launch Signal Desktop from 0mniteck, we see broken attached image but working emoji.

video_2024-12-03_22-35-51.mp4

Small emojis in messages work.

@Botspot
Copy link

Botspot commented Dec 3, 2024

Yes, I can report along with @bellegarde-c that big emojis, aka "stickers" don't function on Signal Unofficial ARM64.

@dennisameling
Copy link
Owner

big emoji icons are broken

I just replied to your dedicated issue here, and I have a feeling that the issue with the big emojis/stickers will be resolved as soon as I remove that Windows-specific patch for the updates/resources URL. To be continued!

@dennisameling
Copy link
Owner

Hi all, it looks like the Signal team has upgraded the version of fs-extra they use from 5.0.0 to 11.2.0. This causes the patch I created earlier to be incompatible.

I'd like to see if things will work fine with you on the newer version without the patch. The 7.35.0 version is now available here which includes the updated fs-extra version. Let me know if it works, and otherwise I'll create an updated patch for version 11.2.0 of fs-extra. Thanks!

@Botspot
Copy link

Botspot commented Dec 4, 2024

Hi all, it looks like the Signal team has upgraded the version of fs-extra they use from 5.0.0 to 11.2.0. This causes the patch I created earlier to be incompatible.

I'd like to see if things will work fine with you on the newer version without the patch. The 7.35.0 version is now available here which includes the updated fs-extra version. Let me know if it works, and otherwise I'll create an updated patch for version 11.2.0 of fs-extra. Thanks!

I can report that the update does break attachments downloading. Could you delete this release or mark it as a prerelease so that our Pi-apps github bot does not upgrade everybody to a Signal version that features a regression?

@dennisameling
Copy link
Owner

Thanks for the quick feedback. I've just marked the release as pre-release to not break folks. Will uploaded an uploaded .deb into it later today with a new patch for the latest fs-extra version.

dennisameling added a commit to dennisameling/signal-desktop-automation that referenced this issue Dec 5, 2024
@dennisameling
Copy link
Owner

I've created the new patch and have kicked off the CI pipeline to build the updated .deb file. The release now has that updated artifact and I've marked it as the "latest release" again.

Can you confirm whether the Attachments functionality works as expected again? Thanks!

@dennisameling dennisameling mentioned this issue Dec 5, 2024
2 tasks
@bellegarde-c
Copy link

I'm working on a "mobile" version of Signal Desktop for Droidian based on your work.

I tried to add your fs-extra patch to my build, I can see the makeFile function in app.asar but attached images/files are not loaded. Any idea what I can be missing ?

https://github.com/bellegarde-c/Signal-Desktop

@bellegarde-c
Copy link

Ok, did not notice but does not work with signal-desktop-unofficial too:

[271798:1206/140906.903309:INFO:CONSOLE(497)] "Uncaught Error: getStreamWithTimeout(getAttachment(/attachments/[REDACTED]R-5)) timed out", source: node:events (497)
[271798:1206/140906.906233:INFO:CONSOLE(497)] "Uncaught AbortError: The user aborted a request.", source: node:events (497)

@bellegarde-c
Copy link

Found, there is an error in your patch:

diff --git a/droidian/fs-extra+11.2.0.patch b/droidian/fs-extra+11.2.0.patch
index 10c6c7344..27d3bc207 100644
--- a/droidian/fs-extra+11.2.0.patch
+++ b/droidian/fs-extra+11.2.0.patch
@@ -10,7 +10,7 @@ index a55c2d9..95760e0 100644
 +  try {
 +    console.log(`Going to create empty file ${file}`)
 +    await fs.writeFile(file, '')
-+  } catch (e) {
++  } catch (err) {
 +    if (process.platform === 'linux' && process.arch === 'arm64') {
 +      console.log(`Error while creating empty file, but ignoring since this is Linux arm64 and the file has most likely been created just fine: ${err}`)
 +    } else {

@yizeky
Copy link

yizeky commented Dec 8, 2024

Hi,
I've tried the latest signal-desktop-unofficial_7.35.0_arm64.deb on my arm chromebook. Attachment and the sticker were not displayed in the chat window.
makeFile() call seems to be failing.

ERROR 2024-12-08T12:40:06.889Z conversation job queue: job [REDACTED]721 failed on attempt 13. ReferenceError: err is not defined at makeFile ([REDACTED]/resources/app.asar/preload.bundle.js:87:3705) at async createFile ([REDACTED]/resources/app.asar/preload.bundle.js:87:3928) at async encryptAttachmentV2ToDisk ([REDACTED]/resources/app.asar/preload.bundle.js:88:8294) at async encryptAndUploadAttachment ([REDACTED]/resources/app.asar/preload.bundle.js:107:278159) at async uploadAttachment ([REDACTED]/resources/app.asar/preload.bundle.js:107:277372) at async run ([REDACTED]/resources/app.asar/preload.bundle.js:23:30814)

@dennisameling
Copy link
Owner

Hi folks, thanks for reporting. There's indeed a typo in my patch for fs-extra. Just fixed that and re-ran the build for 7.35.1. The updated .deb file is available in the release again. Sorry for the trouble!

@yizeky
Copy link

yizeky commented Dec 22, 2024

7.35.1 is working in the arm chromebook very well. Thank you!

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

15 participants