Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Running Mesen-X headlessly with xvfb-run #64

Closed
empathicqubit opened this issue Nov 24, 2021 · 5 comments
Closed

Running Mesen-X headlessly with xvfb-run #64

empathicqubit opened this issue Nov 24, 2021 · 5 comments

Comments

@empathicqubit
Copy link

empathicqubit commented Nov 24, 2021

Hello there. I'm trying to run Mesen-X inside my build process, which worked before with SourMesen 0.9.9. I've run this test code locally and it works correctly, so I assume there's some new problem with running with a headless X server. Any pointers for getting it working would be helpful. Version details of the container:

root@d5f640aa1abd:/# mono --version
Mono JIT compiler version 4.6.2 (Debian 4.6.2.7+dfsg-1ubuntu1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen
root@d5f640aa1abd:/# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.6 LTS
Release:	18.04
Codename:	bionic
root@d5f640aa1abd:/# 

I would prefer not to update these because I need to support older environments.

The Mesen output:

xvfb-run ["-a","mono","/__w/vscode-cc65-debugger/vscode-cc65-debugger/src/__tests__/mesendir/Mesen.exe","--testrunner","/__w/vscode-cc65-debugger/vscode-cc65-debugger/src/../dist/mesen/mesen_binary_monitor.lua","/__w/vscode-cc65-debugger/vscode-cc65-debugger/src/__tests__/simple-project/program.nes"]
  
        at MesenGrip.autostart (src/dbg/mesen-grip.ts:44:21)
            at runMicrotasks (<anonymous>)
  
      console.log
        Stacktrace:
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
          at <unknown> <0xffffffff>
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
          at (wrapper managed-to-native) System.Windows.Forms.XplatUIX11.XCreateFontCursor (intptr,System.Windows.Forms.CursorFontShape) <0x00065>
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
          at System.Windows.Forms.XplatUIX11.DefineStdCursor (System.Windows.Forms.StdCursor) <0x0006b>
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
          at System.Windows.Forms.XplatUI.DefineStdCursor (System.Windows.Forms.StdCursor) <0x00024>
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
          at System.Windows.Forms.Cursor..ctor (System.Windows.Forms.StdCursor) <0x0001b>
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
          at System.Windows.Forms.Cursors.get_Default () <0x0003f>
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
          at System.Windows.Forms.ScrollBar..ctor () <0x0066f>
          at System.Windows.Forms.HScrollBar..ctor () <0x0000f>
          at System.Windows.Forms.ImplicitHScrollBar..ctor () <0x0000f>
          at (wrapper remoting-invoke-with-check) System.Windows.Forms.ImplicitHScrollBar..ctor () <0x00033>
          at System.Windows.Forms.ScrollableControl.CreateScrollbars () <0x0003b>
          at System.Windows.Forms.ScrollableControl..ctor () <0x003eb>
          at System.Windows.Forms.ContainerControl..ctor () <0x00027>
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
          at System.Windows.Forms.Form..ctor () <0x000f3>
          at System.Windows.Forms.MessageBox/MessageBoxForm..ctor (System.Windows.Forms.IWin32Window,string,string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon,bool) <0x00093>
          at System.Windows.Forms.MessageBox/MessageBoxForm..ctor (System.Windows.Forms.IWin32Window,string,string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon) <0x00047>
          at (wrapper remoting-invoke-with-check) System.Windows.Forms.MessageBox/MessageBoxForm..ctor (System.Windows.Forms.IWin32Window,string,string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon) <0x0007b>
          at System.Windows.Forms.MessageBox.Show (string,string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon) <0x0004f>
          at Mesen.GUI.Forms.MesenMsgBox.Show (string,System.Windows.Forms.MessageBoxButtons,System.Windows.Forms.MessageBoxIcon,string[]) <0x001e3>
          at Mesen.GUI.RuntimeChecker.TestDll () <0x00147>
          at Mesen.GUI.Program.Main (string[]) <0x00757>
          at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0x000d1>
        
        Native stacktrace:
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
        Segmentation fault (core dumped)
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
@empathicqubit
Copy link
Author

Here is a link to my container's Dockerfile: https://github.com/empathicqubit/vscode-cc65-debugger/blob/master/docker/Dockerfile

@empathicqubit
Copy link
Author

I think ideally xvfb would not be necessary at all, but that's a different issue.

@empathicqubit
Copy link
Author

Possibly similar issue? https://trac.ffmpeg.org/ticket/1738

@empathicqubit
Copy link
Author

empathicqubit commented Nov 25, 2021

Upgrading Mono fixes that specific issue, but now I'm sorting through a native code exception. I think I'm okay with updating Mono since there is an official path for that. Updating libc is impossible, however. Please look at the above PR for the Github Actions script when you get the chance.

This is as far as I've gotten using Xvfb with these changes. The test still works locally.

        Starting Mesen xvfb-run ["-a","mono","/__w/vscode-cc65-debugger/vscode-cc65-debugger/src/__tests__/mesendir/Mesen.exe","--testrunner","/__w/vscode-cc65-debugger/vscode-cc65-debugger/src/../dist/mesen/mesen_binary_monitor.lua","/__w/vscode-cc65-debugger/vscode-cc65-debugger/src/__tests__/simple-project/program.nes"]
  
        at MesenGrip.autostart (src/dbg/mesen-grip.ts:49:21)
  
      console.log
        Could not set X locale modifiers
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
        
        =================================================================
        	Native Crash Reporting
        =================================================================
        Got a SIGSEGV while executing native code. This usually indicates
        a fatal error in the mono runtime or one of the native libraries 
        used by your application.
        =================================================================
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)
  
      console.log
        Aborted (core dumped)
  
        at Socket.<anonymous> (src/__tests__/test-shared.ts:79:80)

@empathicqubit
Copy link
Author

empathicqubit commented Nov 25, 2021

PR #66 seems to fix the issue

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

No branches or pull requests

1 participant