Skip to content

Handle exotic window managers better #212

Open

Description

@petterroea

Note: i am not expecting some fancy solution to this, i'm just suggesting that it doesn't crash

My window manager(i3) starts applications as tiles with forced sizes by default. Fuse does not like this, and segfaults. I figured out that was the reason, as adding a float override to the window title in i3's config solved the issue.

Stack trace:

Program received signal SIGSEGV, Segmentation fault.
0x00005555558edaa4 in uBuildMemory(uType*) ()
(gdb) bt
#0  0x00005555558edaa4 in uBuildMemory(uType*) ()
#1  0x00005555558f447f in uType::Build() [clone .part.187] ()
#2  0x00005555558f3826 in uGetParameterization(uTypeKey const&) ()
#3  0x00005555558f3f68 in uType::MakeType(uType*, ...) ()
#4  0x00005555558a34fe in g::Uno::Platform::CoreApp_build(uType*) ()
#5  0x00005555558f4980 in uType::Init() ()
#6  0x00005555558a6f53 in g::Uno::Platform::CoreApp::Current() ()
#7  0x0000555555858092 in g::Uno::Application::Current1() ()
#8  0x00005555558b2183 in g::Uno::Runtime::Implementation::Internal::Bootstrapper::OnWindowSizeChanged(Xli::Window*) ()
#9  0x00005555558ec21c in uMainLoop::OnSizeChanged(Xli::Window*) ()
#10 0x00005555558fe39a in Xli::Window::ProcessMessages() ()
#11 0x00005555558eca1b in uMainLoop::uMainLoop() ()
#12 0x0000555555589326 in main ()

Expected behavior

App launches in some way shape or form

Actual behavior

Segfault

Suggested fix

My assumption is that uno is making assumptions based on an expected window size. I think, without looking at the code, that basing all size calculations on the actual window size coud fix this. But it's probably not that easy.

OS details

➜  ~ screenfetch
                   -`                 
                  .o+`                 petterroea@petterroea-arch
                 `ooo/                 OS: Arch Linux 
                `+oooo:                Kernel: x86_64 Linux 5.1.4-arch1-1-ARCH
               `+oooooo:               Uptime: 9h 15m
               -+oooooo+:              Packages: 1357
             `/:-:++oooo+:             Shell: zsh 5.7.1
            `/++++/+++++++:            Resolution: 7680x2160
           `/++++++++++++++:           DE: KDE
          `/+++ooooooooooooo/`         WM: i3
         ./ooosssso++osssssso+`        CPU: Intel Core i7-8700K @ 12x 4.7GHz [27.8°C]
        .oossssso-````/ossssss+`       GPU: GeForce GTX 1060 6GB
       -osssssso.      :ssssssso.      RAM: 10554MiB / 15973MiB
      :osssssss/        osssso+++.    
     /ossssssss/        +ssssooo/-    
   `/ossssso+/:-        -:/+osssso+-  
  `+sso+:-`                 `.-/+oso: 
 `++:.                           `-/+/
 .`                                 `/

Activity

  1. mortend commented on Aug 8, 2019

    @mortend
    Member

    Thank you for testing!

  2. kusma commented on Aug 8, 2019

    @kusma
    Contributor

    From the stack-trace, it doesn't seem related to the window-manager, though.

  3. mortend commented on Aug 8, 2019

    @mortend
    Member

    If you want to debug more, you can try passing -DDEBUG_UNSAFE and -DDEBUG_NATIVE to uno build, and see if that generates any interesting output. Maybe also -DDEBUG_ARC1.

  4. petterroea commented on Aug 19, 2019

    @petterroea
    Author

    will do

  5. petterroea commented on Aug 21, 2019

    @petterroea
    Author

    When running with -DDEBUG_ARC1 I get

    /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/Memory.cpp:224:56: error: ‘class std::vector<uObject*>’ has no member named ‘Length’
      224 |         for (size_t i = 0; i < thread->AutoReleaseList.Length(); i++)
          |                                                        ^~~~~~
    make[2]: *** [CMakeFiles/InfectedApp.dir/build.make:1753: CMakeFiles/InfectedApp.dir/src/Uno/Memory.cpp.o] Error 1                                                                                            
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/InfectedApp.dir/all] Error 2                                                                                                                                
    make: *** [Makefile:84: all] Error 2
    
    
  6. petterroea commented on Aug 21, 2019

    @petterroea
    Author

    Running with all other flags, i get a pretty "This program has crashed" Dialog, and the following output in gdb:

    (gdb) r
    Starting program: /home/petterroea/git/infected/InfectedApp/build/Native/Debug/InfectedApp 
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/usr/lib/libthread_db.so.1".
    Fatal: Runtime Error in /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp(529): f.Flags == uFieldFlagsInherited
    [Detaching after fork from child process 14769]
    
    Program received signal SIGABRT, Aborted.
    0x00007ffff3fb4755 in raise () from /usr/lib/libc.so.6
    

    Backtrace:

    (gdb) bt
    #0  0x00007ffff3fb4755 in raise () at /usr/lib/libc.so.6
    #1  0x00007ffff3f9f851 in abort () at /usr/lib/libc.so.6
    #2  0x00005555559198c0 in uFatal(char const*, char const*)
        (src=0x5555559943b8 "/home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp(529)", msg=0x555555994398 "f.Flags == uFieldFlagsInherited")
        at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/Support.cpp:99
    #3  0x000055555590d8a1 in uCopyBaseFields(uType*, uType*, size_t&) (type=0x555556008ea0, base=0x555556008c60, parentCount=@0x7fffffffd1d8: 1)
        at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp:529
    #4  0x000055555590db24 in uBuildParameterization(uType*) (type=0x555556008ea0) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp:565
    #5  0x000055555590eae1 in uType::Build() (this=0x555556008ea0) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp:760
    #6  0x000055555590d210 in uBuildTypes() () at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp:384
    #7  0x000055555590d4e7 in uGetParameterization(uTypeKey const&) (key=...) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp:459
    #8  0x000055555590e990 in uType::MakeType(uType*, ...) (this=0x555556001540, first=0x555555b0ae10) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp:732
    #9  0x00005555558cbc51 in g::Uno::Platform::CoreApp_build(uType*) (type=0x555556008c60) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno.Platform.g.cpp:105
    #10 0x000055555590ead5 in uType::Build() (this=0x555556008c60) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp:758
    #11 0x000055555590eb63 in uType::Init() (this=0x555556008c60) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/ObjectModel.cpp:779
    #12 0x00005555558cd0fb in g::Uno::Platform::CoreApp::Current() () at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno.Platform.g.cpp:544
    #13 0x0000555555884910 in g::Uno::Application::Current1() () at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno.g.cpp:401
    #14 0x00005555558d3b6a in g::Uno::Runtime::Implementation::Internal::Bootstrapper::OnWindowSizeChanged(Xli::Window*) (handle=0x555555fc2a30)
        at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno.Runtime.Implementation.Internal.g.cpp:563
    #15 0x00005555559077b0 in uMainLoop::OnSizeChanged(Xli::Window*) (this=0x7fffffffd960, wnd=0x555555fc2a30) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/_main.cpp:258
    #16 0x00005555559224ba in Xli::Window::ProcessMessages() ()
    #17 0x0000555555906db6 in uMainLoop::uMainLoop() (this=0x7fffffffd960) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/_main.cpp:91
    #18 0x0000555555906679 in main(int, char**) (argc=1, argv=0x7fffffffdc28) at /home/petterroea/git/infected/InfectedApp/build/Native/Debug/src/Uno/_main.cpp:338
    
    
  7. petterroea commented on Aug 21, 2019

    @petterroea
    Author

    @kusma I agree it doesn't seem to be directly related to the window-manager, but my theory is that it is a "follow error" due to uno disagreeing with the OS on the window size, as it is forced. I do not expect any references to the window manager in this case, and we do see that OnSizeChanged is in the stack trace, so this is obviously somehow connected to the window size

  8. kusma commented on Aug 22, 2019

    @kusma
    Contributor

    No, this seems to happen in the type system, which I think is extremely unlikely to be related to window geometry.

  9. petterroea commented on Aug 23, 2019

    @petterroea
    Author

    Ok. How can i assist in debugging this issue further

  10. mortend commented on Aug 26, 2019

    @mortend
    Member

    If you can set a breakpoint and inspect local variables, it'd be interesting to see the values of FullName fields in type and base parameters in uCopyBaseFields().

  11. mortend commented on Aug 26, 2019

    @mortend
    Member

    Also, does it crash if you run a plain empty project?

    uno create -capp app
    uno build native app --run
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions