Skip to content

[Bioc-devel] ExperimentHub Package Error - C stack usage (R, BioC devel)

1 message · Hervé Pagès

#
Hi Hiru,

The "C stack usage? 7976644 is too close to the limit" error is very 
reproducible: we see it on all devel builders and I can easily reproduce 
it on my laptop with:

 ? ? library(ExperimentHub)
 ? ? eh <- ExperimentHub()
 ? ? x <- eh[["EH5376"]]

After some digging into this, I found that the problem was caused by a 
combination of unfortunate situations:

(1) The EH5376 resource is a nested list that contains old serialized 
ggplot instances! I wonder what these ggplot objects are doing in 
ExperimentHub. Anyways, as you know, the latest version of the ggplot2 
package (v 4.0.0) went thru some important internal refactoring of the 
numerous classes that it defines, which means that any ggplot object 
that got created/serialized **before** this refactoring is now 
invalid/broken. If these ggplot instances ended up in ExperimentHub by 
mistake, please consider updating/replacing the resource with something 
that is free of them. If they really need to be there, the resource 
would still need to be updated/replaced with something that contains 
**current** ggplot objects, that is ggplot object created with ggplot2 
 >= 4.0.0.

(2) For some mysterious reason, the old ggplot instances contained 
in?EH5376 contain an environment that contains itself! For example:

 ? ? object <- x[[1]]$plotting$ggdendro_vertical
 ? ? class(object)
 ? ? # [1] "gg"? ? ?"ggplot"
 ? ? object$plot_env
 ? ? # <environment: 0x62c2536e6858>
 ? ? object$plot_env$b1$plot_env
 ? ? # <environment: 0x62c2536e6858>

This is what triggers?the "C stack usage? 7976644 is too close to the 
limit" error. You see, when an EH resource is loaded 
with?eh[["EHXXXX"]], the code in ExperimentHub/AnnotationHub calls 
updateObject() internally on the object to return to the user right 
before returning it. The updateObject() generic and some of its methods 
are defined in the BiocGenerics package. One of the methods defined in 
BiocGenerics is the method for environments. This method walks 
recursively on the environment to update in order to visit and update 
all its components. The problem is?that this yields to an infinite 
recursion if an environment contains itself. This infinite recursion 
which is what the?"C stack usage? 7976644 is too close to the limit" 
error is about.

In the latest BiocGenerics (0.55.3 in devel, 0.54.1 in release), I 
modified the updateObject() method for environments to avoid the 
infinite recursion if an environment contains itself. With this fix, I 
can do?eh[["EHXXXX"]]?without getting the?"C stack usage 7976644 is too 
close to the limit" error, so this error should go away on the build 
report in a couple of days.

However, I would still recommend that you do something about the?old 
serialized ggplot instances contained in the?EH5376 resource.

Cheers,

H.
On 23/09/2025 06:39, Hiranyamaya Dash wrote: