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

panic: interface conversion: interface {} is string, not uint32 #38

Closed
matperc opened this issue Nov 11, 2024 · 12 comments
Closed

panic: interface conversion: interface {} is string, not uint32 #38

matperc opened this issue Nov 11, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@matperc
Copy link

matperc commented Nov 11, 2024

panic: interface conversion: interface {} is string, not uint32

goroutine 1 [running]:
main.(*Command).waitForSignals(0xc0000c0120, 0xc00007c180)
        /home/runner/work/host-spawn/host-spawn/command.go:137 +0x1b5
main.(*Command).SpawnAndWait(0xc0000c0120)
        /home/runner/work/host-spawn/host-spawn/command.go:109 +0x997
main.main()
        /home/runner/work/host-spawn/host-spawn/main.go:121 +0x4fe

I use host-spawn to run commands from flatpak Emacs. Sometimes it crashes with this error. What could it be?

@1player
Copy link
Owner

1player commented Nov 11, 2024

No idea. Can you reproduce from a shell and provide the elisp incantations you're using to run host-spawn?

@matperc
Copy link
Author

matperc commented Nov 11, 2024

It's a complicated setup, I'll try to simplify a bit in the next days and see what happens.

Do I understand correctly that, even if the panic was handled, the command is still closing with HostCommandExited signal?

@matperc
Copy link
Author

matperc commented Nov 11, 2024

Ok I simplified my tries until this:

  1. Download host-spawn-x86-64 v1.6.0
  2. Download emacs from Flathub
  3. Run emacs
  4. M-x term inside emacs (Alt-x term RET)
  5. Run host-spawn without arguments
  6. Call some process for example top, or just wait
  7. Some time later the error above appears, and the shell returns to flatpak

@1player
Copy link
Owner

1player commented Nov 12, 2024

I cannot reproduce. From Flathub's Emacs (started with a bare config), within a term, host-spawn is able to spawn an host shell, top works correctly for me, etc.

Can you provide any details about your linux distro? Can you reproduce the problem from inside a toolbox or distrobox container?

Your error seems to be caused by the fact that host-spawn, subscribed only to HostCommandExited DBus messages, receives an unexpected message and doesn't handle this case very well; it certainly should print a more helpful message than just panicking. I have seen weird errors from people using niche distros with missing or misconfigured flatpak/dbus.

If you are able to use git and compile go software, I can push some changes for you to test with.

@1player
Copy link
Owner

1player commented Nov 12, 2024

Please try the robustness branch, which should print a more helpful error when host-spawn crashes.

https://github.com/1player/host-spawn/tree/robustness

@matperc
Copy link
Author

matperc commented Nov 12, 2024

Thanks for taking your time to look into it.

I failed to mention that the issue appears after a lot of time, randomly between 10 minutes to some hour. It seems worse when the PC is used intensively.

What do you mean inside a distrobox? Instead of flatpak?

I never tried compile a Go program, but I will try later today.

I replicated the issue both on Fedora Silverblue and Fedora Workstation. Both updated to the lastest version

@matperc
Copy link
Author

matperc commented Nov 12, 2024

unexpected DBus message &dbus.Signal{Sender:"org.freedesktop.DBus", Path:"/org/freedesktop/DBus", Name:"org.freedesktop.DBus.NameOwnerChanged", Body:[]interface {}{"org.freedesktop.portal.Flatpak", "", ":1.123"}, Sequence:0x5}

Here we go

Here the error after the above ~ 20 minutes later

unexpected DBus message &dbus.Signal{Sender:"org.freedesktop.DBus", Path:"/org/freedesktop/DBus", Name:"org.freedesktop.DBus.NameOwnerChanged", Body:[]interface {}{"org.freedesktop.portal.Flatpak", ":1.123", ""}, Sequence:0x5}

It is very similar but it seems that the parameter of Body are swapped, I don't know what that means. At the same time I had a distrobox open similarly (distrobox->host-spawn->top) but without emacs and there was no problem.

Update:
This issue is reproducible even in other flatpaks. I run flatpak run --command=/bin/bash org.gnome.Calculator and then run host-spawn inside it. At the same time the issue closed both this instance and the Emacs one, with the same error:

unexpected DBus message &dbus.Signal{Sender:"org.freedesktop.DBus", Path:"/org/freedesktop/DBus", Name:"org.freedesktop.DBus.NameOwnerChanged", Body:[]interface {}{"org.freedesktop.portal.Flatpak", ":1.149", ""}, Sequence:0x5}

@1player
Copy link
Owner

1player commented Nov 13, 2024 via email

@1player
Copy link
Owner

1player commented Nov 13, 2024

Can you please try again with the latest commit on the robustness branch? Now we actually check the message name, and ignore anything that we don't care about.

@1player 1player added the bug Something isn't working label Nov 13, 2024
@matperc
Copy link
Author

matperc commented Nov 14, 2024

Thanks for the fix, I have been working the whole day with no problem. I also applied a similar patch yesterday and the issue never occurred.

I am not sure if HostCommandExited is captured correctly, I am unable to verify it. Otherwise, for my use case, it works perfectly.

@1player
Copy link
Owner

1player commented Nov 14, 2024

Yes the fix is pretty straightforward, so I guess it won't crash again. I'll be merging into master and cutting a new release soon.

@1player 1player closed this as completed Nov 14, 2024
@1player
Copy link
Owner

1player commented Jan 10, 2025

Fix released with version 1.6.1 (sorry for the delay)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants