<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>IT notes - fork</title>
    <subtitle>DBRE, AWS platform engineering, PostgreSQL, Linux, FreeBSD, and Rust reference notes.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://nbari.com/tags/fork/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://nbari.com"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2018-03-22T15:28:13+01:00</updated>
    <id>https://nbari.com/tags/fork/atom.xml</id>
    <entry xml:lang="en">
        <title>OBJC_DISABLE_INITIALIZE_FORK_SAFETY</title>
        <published>2018-03-22T15:28:13+01:00</published>
        <updated>2018-03-22T15:28:13+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/objc-disable-initialize-fork-safety/"/>
        <id>https://nbari.com/objc-disable-initialize-fork-safety/</id>
        
        <content type="html" xml:base="https://nbari.com/objc-disable-initialize-fork-safety/">&lt;p&gt;In macOS High Sierra if getting this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;objc[55492]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;objc[55492]: +[__NSPlaceholderDate 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.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Define:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will fix temporally fix the problem and allow program to continue
executing, more about this issue here: http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html&lt;/p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>forkbomb</title>
        <published>2016-12-08T11:11:36+01:00</published>
        <updated>2016-12-08T11:11:36+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/forkbomb/"/>
        <id>https://nbari.com/forkbomb/</id>
        
        <content type="html" xml:base="https://nbari.com/forkbomb/">&lt;h1 id=&quot;forkbomb&quot;&gt;&lt;a class=&quot;zola-anchor&quot; href=&quot;#forkbomb&quot; aria-label=&quot;Anchor link for: forkbomb&quot;&gt;🔗&lt;/a&gt;forkbomb&lt;/h1&gt;
&lt;p&gt;C example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;stdio.h&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-8&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;() {&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; while&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt; fork&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;(); }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To compile:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ clang bomg.c&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Python example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;import&lt;/span&gt;&lt;span&gt; os&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; True:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    os&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-2&quot;&gt;fork&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How to prevent it, use &lt;a rel=&quot;external&quot; href=&quot;https://www.freebsd.org/doc/handbook/security-resourcelimits.html&quot;&gt;RCTL&lt;/a&gt;
for example in a jail:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ rctl -a jail:myJail:maxproc:deny=50&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
</feed>
