X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=n/h hK2WS4FxUD1hGokoBG4y+E1vmoRqAz7ky4z+83Udgx9x5E/3qqWdmzJdu4vkUsJR pQ2en7NwpIXDd2cUzY7SM3d28XNt4/kcOPzzpIz0JsNenc7VeR/3a3aW2IirfLxi NwAlgFes9v+nMPL5kq7+qgqZmlNu4lsRM3blsfGQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; s=default; bh=fnz6AWWx+ kovjhEQMTrMXNzCX1w=; b=nJyLTYu5T274KhAMhkyNe81KHcA2jGeQ7JQ6Ht1PT dV5qF6K1jdaoUPb6XCWpmgNzC87ebWr9FKDDi99zRNqWtUkxuIk3m1sa9WhlJwY/ dG8etvsCOyxT4H2yFMSqQmafJQAbcC9hPf7dHkKgip41zOTixKjfPiQ9P9zfTaUp AY= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=DLL, H*Ad:U*alexey X-HELO: mail-wm0-f51.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=g0oO5XXeDJE+uwj6b9KFnoEC9q3dFgPlbgICDOKCNRE=; b=KMq4BCBFMMMHoSsINWXivtdN5lCWjcEb4tpQuGBiPUiNqo4yVukx5+BIXFFffS2aWR bUZaOoKZ/6oPOMXvwDBKCcF1n7pAN/w/LMuqa1lijw74DVVp3gkjr5lbI2cwXk/Y7H4Z nBRdXKArPsulrhKuosknj7gITRMAwRaLyOW+YGH8ddfQCvzoxv3fjcCCSlaGtmlRvYMf 9yzEgQMXT/SgWLbWTfkxSi/lYcflu5lFz45yRc24exgC32ADRX0yOZh5ZLo5nBpP/vhQ +cRkO8DWweTLh61fL9HXg3VlmRhxqvfXECZgvw2sJnOM2E5v0zu/EtpUMpKbHXV9F3P0 szZw== X-Gm-Message-State: AFeK/H1v52wybWB7MmkRwrNqNF/CpAVhRO0q+C3k5dIVjccoOmONV/I+QPNV55LGE3/iaA== X-Received: by 10.28.104.6 with SMTP id d6mr1642065wmc.79.1490087021386; Tue, 21 Mar 2017 02:03:41 -0700 (PDT) To: cygwin AT cygwin DOT com From: Alexey Sokolov Subject: dlclose() vs fork() Message-ID: <1504e7ff-dd60-f55f-d00a-0a1ae5d5e034@asokolov.org> Date: Tue, 21 Mar 2017 09:03:37 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Hello, If the same DLL is dlopen()ed several times, dlclose() will actually unload the DLL only after the same number of calls to dlclose(). This works fine in cygwin, until we add fork(). It looks like in the child process the counters of inherited DLLs are set to 1, so the first dlclose() unloads it, causing segfault for subsequent access to the unloaded code. https://github.com/znc/znc/issues/1385#issuecomment-288014319 has a working minimal example of this behavior. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple