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

Uncaught exception when running virtualization example program #43

Closed
cfergeau opened this issue Sep 8, 2022 · 2 comments · Fixed by #78
Closed

Uncaught exception when running virtualization example program #43

cfergeau opened this issue Sep 8, 2022 · 2 comments · Fixed by #78

Comments

@cfergeau
Copy link
Contributor

cfergeau commented Sep 8, 2022

With master, if I run the linux virtualization example without setting any of the required env vars, I'm getting this failure:

% ./virtualization 
2022-09-08 12:11:46.146 virtualization[37825:952616] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[VZLinuxBootLoader initWithKernelURL:]: The URL (null) is not a file URL'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001891711a8 __exceptionPreprocess + 240
	1   libobjc.A.dylib                     0x0000000188ebbe04 objc_exception_throw + 60
	2   CoreFoundation                      0x0000000189170ff4 +[NSException exceptionWithName:reason:userInfo:] + 0
	3   Virtualization                      0x00000001ef375478 _ZN2Vz32raise_invalid_argument_exceptionEP11objc_objectP13objc_selectorP8NSStringz + 176
	4   Virtualization                      0x00000001ef2b963c _ZN2Vz20validate_is_file_urlEP5NSURLP11objc_objectP13objc_selector + 96
	5   Virtualization                      0x00000001ef33b8e8 -[VZLinuxBootLoader initWithKernelURL:] + 56
	6   virtualization                      0x00000001041a59d8 newVZLinuxBootLoader + 104
	7   virtualization                      0x00000001041a40a0 _cgo_16e5e8d7eb11_Cfunc_newVZLinuxBootLoader + 36
	8   virtualization                      0x00000001040f48ec runtime.asmcgocall.abi0 + 124
)
libc++abi: terminating with uncaught exception of type NSException
SIGABRT: abort
PC=0x188feed98 m=0 sigcode=0
signal arrived during cgo execution

VZLinuxBootLoader initWithKernelURL throws an exception because we pass it a null/empty URL, but nothing is catching this exception, so the application gets killed. It would be a lot nicer if calling VZLinuxBootLoader initWithKernelURL with invalid arguments would return a regular go error.

@Code-Hex
Copy link
Owner

Code-Hex commented Sep 8, 2022

@cfergeau Thanks for your reporting!

Exactly, we should handle them

@cfergeau
Copy link
Contributor Author

Maybe it's possible to get other exceptions from these methods? The current fix avoids 'file not found' exceptions. There will still be crashes if an exception is raised for another reason.

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

Successfully merging a pull request may close this issue.

2 participants