From edd @ending from debi@n@org  Thu Aug  9 21:38:20 2018
From: edd @ending from debi@n@org (Dirk Eddelbuettel)
Date: Thu, 9 Aug 2018 14:38:20 -0500
Subject: [Rd] 
 SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp
In-Reply-To: <alpine.DEB.2.20.1808091406240.3237@luke-Latitude-7480>
References: <CALEXWq2E+-k=Oka1YZAzGzYU1bLmcC3ptUUrv8RUMUrpcviK-g@mail.gmail.com>
 <a03f65c7-3e0e-7857-0e1e-a809e1051b56@gmail.com>
 <23404.36580.740017.811392@rob.eddelbuettel.com>
 <alpine.DEB.2.20.1808091406240.3237@luke-Latitude-7480>
Message-ID: <23404.38956.878475.983796@rob.eddelbuettel.com>


On 9 August 2018 at 14:13, luke-tierney at uiowa.edu wrote:
| On Thu, 9 Aug 2018, Dirk Eddelbuettel wrote:
| 
| >
| > On 9 August 2018 at 20:37, Tomas Kalibera wrote:
| > | So to answer your original question, this could probably be handled in
| > | Rcpp,
| >
| > Hm. Why do you say that / what did you have in mind?
| 
| We say it because it is true. Rcpp registers C finalizers and running
| them after unloading will segfault. For now it would be better for Rcpp
| (and everyone else) to explicitly discourage unloading as it is
| unreliable on many levels.
| 
| What Rcpp could do to avoid segfaulting is to keep a weak list of all
| objects to which it attaches C finalizers and arrange for those to be
| cleaned up in an R_unload_<dllname> routine. Not clear it is worth the
| trouble. At the R level we could provide more support for this since
| we already have a weak list of objects with finalizers, but again not
| clear it is worth the trouble.

Ah, noted, thanks for the explainer.

As I remain in camp "don't try unloading" I won't make this a priority
myself, but as always open to credible PRs. Could start with an issue ticket
and discussion if anybody is so inclined.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



[Rd] SIGSEGV in R_RunWeakRefFinalizer, object allocated with Rcpp
Dirk Eddelbuettel