irssi / irssi/scripts.irssi.org

[scriptassist.pl] strange ObjC error message relating to fork()

Open
#887 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Perl
Stars
507
Forks
240
PR merge metrics
No merged PRs in 30d

Description

I get a strange error message when doing any `/script` command:
```
objc[23348]: +[NSMutableString initialize] may have been in progress
in another thread when fork() was called. We cannot safely call it or
ignore it in the fork() child process. Crashing instead. Set a breakpoint
on objc_initializeAfterForkError to debug.
```

This text seemingly comes from stderr. After switching to another channel, and then back to where I did the `/script` (in status), the error message is gone, and the following output is shown:
```
16:36 >> Please wait...
16:36 << Something weird happend (no text)
```

The requested `/script` operation is not performed, of course.

I'm on macOS (15.4), which explains the reference to ObjC. I have installed irssi (1.4.5 (20231003 1405)) from homebrew. irssi runs inside a tmux (3.5a), which is also from homebrew. The terminal emulator is iTerm2 (Build 3.5.12beta3) which downloaded from their website.

This leaves quite a couple of "ususal suspects" for emitting the error message.

To make things even more strange (to me at least), I came across [this gist](https://gist.github.com/zanetagebka/3b9b42c92ce5926fd5aada6b3a9535a5), and tried it out for curiosity. And to my suprise, setting `export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES` in the shell before issuing `tmux new irssi` **does resolve the issue.** [This post on the Apple developer forums](https://developer.apple.com/forums/thread/701358) seems to confirm that it is the foreseen solution.

While this mutes the error message, and puts `/script` back to "as expected", it would still seem worthwhile hunting down which of the involved packages triggers the "fork safety" thing, and then ask the knowledgeable and appropriate people to consider whether they would either like to set that environment variable by default on macOS, or whether any other solution (i.e. changing their code) would seem more appropriate.

Irssi itself will very probably not be containing any ObjC code? Could any of you experts here check whether the safety trigger perhaps happens anywhere in the Perl interpreter, or any native Perl module that `scriptassist` may use?

This is just a starting point for a perhaps (likely?) longer journey well beyond irssi itself... **Many thanks in advance for your support!**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.