-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
M1 arm64 deadlock #43
Comments
Process 2159 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000000013fe00634 obs-test.so`notok + 4
obs-test.so`notok:
-> 0x13fe00634 <+4>: str x8, [x8]
0x13fe00638 <+8>: b 0x13fe00638 ; <+8>
0x13fe0063c <+12>: udf #0x0
obs-test.so`runtime.open_trampoline.abi0:
0x13fe00640 <+0>: str x30, [sp, #-0x10]!
Target 0: (OBS) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x000000013fe00634 obs-test.so`notok + 4
frame #1: 0x000000013fe00c30 obs-test.so`runtime.sigaltstack_trampoline.abi0 + 32
frame #2: 0x000000013fdff908 obs-test.so`runtime.asmcgocall.abi0 + 200
frame #3: 0x000000013fdff908 obs-test.so`runtime.asmcgocall.abi0 + 200
frame #4: 0x000000013fdff908 obs-test.so`runtime.asmcgocall.abi0 + 200 |
I also believe I am running into this on OBS 28 beta 2 on an M1 mini. |
I wonder if anyone with a beta of macOS Ventura wants to check if the issue persists. |
I tried it. macOS Ventura 13.0 Beta |
Thanks for checking. It does not take us much further - but is a good piece of information. |
A custom build of OBS with enabled |
Things are getting wild. With this OBS patch applied it seems to run fine: --- a/UI/obs-app.cpp
+++ b/UI/obs-app.cpp
@@ -3055,6 +3055,19 @@ void ctrlc_handler(int s)
int main(int argc, char *argv[])
{
+#if defined __APPLE__ && defined __arm64__
+ char signalStack[SIGSTKSZ];
+ stack_t ss;
+ memset(&ss, 0, sizeof(ss));
+ ss.ss_sp = signalStack;
+ ss.ss_flags = 0;
+ ss.ss_size = SIGSTKSZ;
+ if (sigaltstack(&ss, NULL) < 0) {
+ perror("sigaltstack");
+ abort();
+ }
+#endif
+
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
Not sure though whether this breaks any existing signals/signal handlers. |
Here is a 0.6.1 version of the macOS plugin for M1/M2 if anyone interested. You will need to apply the patch below to OBS Studio and build it yourself to make it work though. diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp
index 02cf48d6c016a..d1143603f93c0 100644
--- a/UI/obs-app.cpp
+++ b/UI/obs-app.cpp
@@ -3165,13 +3165,28 @@ void ctrlc_handler(int s)
int main(int argc, char *argv[])
{
#ifndef _WIN32
- signal(SIGPIPE, SIG_IGN);
+ stack_t ss;
+ ss.ss_sp = malloc(SIGSTKSZ);
+ if (ss.ss_sp == NULL) {
+ fprintf(stderr, "ss_sp alloc failed\n");
+ exit(1);
+ }
+ ss.ss_size = SIGSTKSZ;
+ ss.ss_flags = 0;
+ if (sigaltstack(&ss, NULL) < 0) {
+ perror("sigaltstack");
+ exit(1);
+ }
struct sigaction sig_handler;
- sig_handler.sa_handler = ctrlc_handler;
+ sig_handler.sa_handler = SIG_IGN;
sigemptyset(&sig_handler.sa_mask);
- sig_handler.sa_flags = 0;
+ sig_handler.sa_flags = SA_ONSTACK;
+
+ sigaction(SIGPIPE, &sig_handler, NULL);
+
+ sig_handler.sa_handler = ctrlc_handler;
sigaction(SIGINT, &sig_handler, NULL);
|
For everyone trying this out. Please write back your macOS version and hardware configuration, and whether it has been working for you or not. (You didn't have to have the patch applied, I just want to collect information what may be the root cause of the original problem) |
When launching |
Yes, this is what thich ticket is about.. I can start up OBS when I connect a 2nd monitor and close my Macbook Air's lid. |
To date (February 20, 2023), the only fully working option for how you can play on a PC and stream through a macbook m1 is: Download the obs version for intel on a macbook m1 and install this plugin (teleport) according to the instructions. Since the teleport didn’t start through the obs version of apple silicon, I found a way out in installing the obs version for intel, which works great on the M1. Good luck to all! And thanks for the great alternative to the buggy NDI. P.S. If you have no sound through the teleport plugin when recording a video / broadcast from the obs, then just add your audio sources through the teleport filter. This link works flawlessly. |
this worked for me thank you |
Hello, |
Re-rolling this patch for 29.x version.
I am on a Mac Studio 2022, M1 Max with 32gb of RAM on MacOS Ventura 13.3.1. |
Thanks, I haven't noticed they did some changes in that area. I have updated the original PR here: Check the branch here: Note that I don't expect it to me merged ever. Apple also does not seem to care about the issue, or they consider it a user-space issue but are not telling. |
Does it mean that I have to edit something inside obs? |
Yes. |
Is there a guide somewhere? I'm not that experienced. |
Start here: In general you will have to build OBS with the patch in the PR, or the pasted one above applied. It can be quite an en-devour for the inexperienced I guess. But you will have to check OBS guides, or guides for these developer tools in general. It is way out of the scope than I can do here.. |
Agree with this. If anyone is inexperienced, the
After that, you can follow the first step from the Run Run After that, you can continue to follow the steps in the official wiki's instructions without any issues. My only issue when following the guide was that building from the command line did not work in the
But to get around that:
I wouldn't mind sharing the build I created, but I'm not sure if that is against the rules or anything. |
There is also a |
@andrewmriv can you share ? |
Hello, what script do you mean? |
It has been removed in the meantime from the OBS repository. Check with the OBS team on how to build OBS for macOS. |
Same problem, this was my last outing, I hate NDI, I'm going to get a capture card at once:
|
Is this change being pushed to the OBS branch? I would like to see a work around that does not require people to manually build both OBS and the plugin. I am switching to MacOS for streaming and could really use this plugin. |
I tried getting a fix upstream, but i ran again into issues when trying to remove the signal stack and restoring the old one on exit. Then I hit another documentaion issue on Apple's side and I gave up. But anyone can try getting a proper change upstream.. |
One can do it without patching OBS. It is still annoying though.
If it is not check https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection?language=objc
You will have to check what Xcode version you have installed. So you will need an installation of Xcode. Change the directory for the file location where the sanitizer library is found. Eventually startup fails with something similar to this:
I guess that can happen since the signals are not properly set up now (which the patch does). Just try again, its seems to be working most of the time for me (but only God knows what impacts this behavior). Not sure why this signal would sometimes be triggered though, and I'm not sure if it can happen again while OBS is running.. someone will find out? |
i tried out the workaround mentioned above, and while OBS did open and the plugin loaded, i wasnt able to transmit video via the plugin, nothing would show up in a teleport source (both locally and on another computer) i was able to receive video from another OBS instance on the other computer though edit: my bad, i acidentally had NDI enabled at the same time as teleport so it didnt work, got it fully working now, the fix above seems to be stable |
update: experiencing stability issues with the workaround, the stream isnt always picked up by another OBS instance, and lag issues keep happening as well at random (cant replicate it with changing settings either) |
Check the logs in the case of stability issues. It could very likely be a network congestion (WLAN?). There may indeed be a problem on first start where the plugin is not work correctly. I have not found the reason for it happening. It seems to happen after first installation normally. So I blame Apple's security systems - but could very well be a bug in the plugin, but I don't think it is related to this bug or the workaround. I never found a reliable way to trigger it. |
Hey everyone, so I manage to get it to "work" Here is what I did:
Now, I tried recording my PC via Teleport on my Macbook Pro, quality is good (set to 90) but the audio was laggy. So I'm going to check my settings on that. Here is my MBP info btw: Please forgive me as I don't know the proper use of lingo, quotations, etc in Github |
Yeah, running inside Rosetta is fine. But ideally one could run it natively without the translation layer. |
Hey I'm running into this issue on my m1 as well. Here are the log files during startup with the latest plugin release and the latest obs. I started without the plugin as well so you can see the full log please dm me if you want help troubleshooting 1:1 |
Hello all... so I´m one of those NDI users that LOVED to have teleport on his M1 Max machine, but because Teleport didn´t work on OBS M1 version, never really tried. Since yesterday that the NDI plugin just got messed out - there´s tons of people dealing with this and no one knows what´s happening - I really had to make sure I got teleport, and hey, what a BEAST! In spite of I only got it working on OBS Intel version (so it´s not using my resources of M1 Max and not optimized so I need to use more CPU power to have this working), I can tell that Teleport is THE thing! I only needed Alpha Transparency but... well seems that may take some time, so I am working with Color Key. Not ideal, but it makes what it´s needed, of course with a lack of quality but, it´s damn fast and damn good! Great Quality on transmission! |
You should check on the OBS site on how to build it. Instructions
constantly change and things here get outdated too quickly.
I don't have a macOS sign key, Twitch API keys etc.. so it makes little
sense to build an OBS version without them for distribution. Also it is too
much work for me to maintain it. So you will have to go through that
yourself.
…On Sat, Feb 10, 2024 at 4:42 PM nunowonder ***@***.***> wrote:
Hello all... so I´m one of those NDI users that LOVED to have teleport on
his M1 Max machine, but because Teleport didn´t work on OBS M1 version,
never really tried. Since yesterday that the NDI plugin just got messed out
- there´s tons of people dealing with this and no one knows what´s
happening - I really had to make sure I got teleport, and hey, what a
BEAST! In spite of I only got it working on OBS Intel version (so it´s not
using my resources of M1 Max and not optimized so I need to use more CPU
power to have this working), I can tell that Teleport is THE thing! I only
needed Alpha Transparency but... well seems that may take some time, so I
am working with Color Key. Not ideal, but it makes what it´s needed, of
course with a lack of quality but, it´s damn fast and damn good! Great
Quality on transmission!
My question is: I don´t know how to "build" obs. I´m really noob in that
matter. I really don´t know, even following those guides you posted above,
how or even what to do. Shall I build an OBS that have the plugins already
that I need? and sources and scenes already? And then, I can change
something so that teleport is recognized with my M1 OBS version? Or maybe
you are just releasing a version that WILL work on M1 computers? Please
do.... I truly appreciate that...
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADLKNJQ2AZW54YZ64AMGQTYS6IODAVCNFSM547XBYIKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJTG4YDINRZGA2Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@fzwoch Thank you very much for your answer, but what I was asking for was a Teleport version that would work on M1 OBS, not the build itself, that would be asking too much! ehehe :) |
The Teleport version available is all it can do to work on M1. Due to an Apple bug it is not. So it requires a patched OBS version or the workaround loading address sanitizer libraries. There will be no alpha channel support. |
Ups I didn´t read about alpha channel. Can I ask why? Sorry it's only because I really don´t know why, because we get it with NDI. If it was like a "filter" on source, or sources, or scenes, that would send instead of Main Output? |
Here is another workaround that does not require running with Apple's address sanitizer or building a patched OBS version. I'll also attach a binary, so you won't even need Xcode to be installed. Check the SIP note below though! signalstack.c #include <stdio.h>
#include <stdlib.h>
#include <signal.h>
stack_t stack;
__attribute__((constructor))
void init()
{
printf("SET UP SIGALTSTACK.. ");
stack.ss_sp = malloc(SIGSTKSZ);
if (stack.ss_sp == NULL) {
printf("ss_sp alloc failed\n");
exit(1);
}
stack.ss_size = SIGSTKSZ;
stack.ss_flags = 0;
if (sigaltstack(&stack, NULL) != 0) {
printf("sigaltstack failed\n");
exit(1);
}
printf("DONE\n");
} Compile with: clang -shared signalstack.c -o signalstack.dylib Run with: DYLD_INSERT_LIBRARIES=/path/to/signalstack.dylib /Applications/OBS.app/Contents/MacOS/OBS You will probably still have to tinker with Apple's SIP to allow injection of shared libraries. Check the output for the |
@fzwoch thank you so much for your help! The problem for me is: I don´t understand anything that you wrote... :) |
As another side note: It works just fine with PRISM Live Studio ¯\(ツ)/¯ Was thinking about another try checking address sanitizer and thread sanitizer.. but OBS Studio does not compile with these options enabled. |
Still an issue in 2024, with OSX 15.1 Sequoia and M3. OBS locks up hard launching. The only way I've gotten it to work is download the x86 version of OBS and then have it run (using rosetta) with the compiled switcher dylib as above...
But that OBS is the x86 version, not ARM. It will load after you give Teleport plugin the magic crap in Security Prefpane... and you can add remote teleports, and record- however the recording function will never quit and OBS must be force-quit. Have not tried streaming. My Mac does have SIP enabled, I may turn that off next reboot and check again. |
0.7.3 tries a workaround that may make it work for some on Apple silicon devices. diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index 6f40f440e8..e4dfddb377 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -432,6 +432,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) {
return
}
+ return
c := &sigctxt{info, ctx}
gp := sigFetchG(c)
setg(gp)
diff --git a/src/runtime/sys_darwin_arm64.s b/src/runtime/sys_darwin_arm64.s
index 32d1f95d56..3859029a48 100644
--- a/src/runtime/sys_darwin_arm64.s
+++ b/src/runtime/sys_darwin_arm64.s
@@ -339,8 +339,8 @@ TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0
MOVD 8(R0), R1 // arg 2 old
MOVD 0(R0), R0 // arg 1 new
CALL libc_sigaltstack(SB)
- CBZ R0, 2(PC)
- BL notok<>(SB)
+// CBZ R0, 2(PC)
+// BL notok<>(SB)
#endif
RET
|
Looks like interacting with the the frontend API is deadlocking/crashing OBS.
Can be reproduced with the following plugin:
Could be a Go runtime issue when using cgo. But I have no idea..
The text was updated successfully, but these errors were encountered: