Products | Versions |
---|---|
Spotfire Enterprise Runtime for R | 4.4.1 or earlier |
An infinite recursion can be triggered when version 1.3.0 of the CRAN "glue" package is used with TERR 4.4.1 or earlier.
This can lead to either of the following error conditions:
Error in x[notBytes] : evaluation nested too deeply: infinite recursion / option s(expressions=)?
or
TIBCO Enterprise Runtime for R returned an error: 'TERR crash detected'.
at Spotfire.Dxp.Data.DataFunctions.Executors.LocalFunctionClient.OnExecuting()
at Spotfire.Dxp.Data.DataFunctions.Executors.AbstractFunctionClient.<RunFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.Executors.SPlusFunctionExecutor.<ExecuteFunction>d__0.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__6.MoveNext()
If the value for options("expressions") in TERR has been set too high for the environment to handle, it can allow the infinite recursion to crash TERR.
The following is the discussion for options("expressions") from the "Common Options" section in the help topic that is opened by a call to ?options :
------------
expressions
the maximum depth to which expressions can be nested. This option exists primarily to catch runaway recursive calls in a function. A valid value is 25 to 500000. The default is 300. Note that this protects against stack overflow and cannot be safely expanded beyond about 300. The precise maximum safe value depends on the platform, whether Java is being used or not, and which C functions are being called recursively.
------------
This issue does not occur if you use the previous version of glue (1.2.0) with TERR 4.4.1 or earlier, or if you use glue 1.3.0 with TERR 4.5.0 or later.
The following public knowledge base article outlines one way to install an earlier version of a CRAN package:
https://support.tibco.com/s/article/How-to-access-historical-versions-of-R-packages-from-the-CRAN-repository
Background:
Version 1.3.0 of the user-contributed "glue" package from the open-source R community's CRAN respository (https://cran.r-project.org/) introduced a hidden subscripting method for objects of class "glue", ( glue:::[.glue ).
That glue:::[.glue method calls base::enc2utf8() (via glue::as_glue.character ), but base::enc2utf8() calls "[", which loops back to glue:::[.glue, causing an infinite recursion that looks like this in a TERR traceback() report:
--------------
23: x[notBytes]
22: enc2utf8(x)
21: glue:::as_glue.character(NextMethod())
20: glue:::as_glue(NextMethod())
19: glue:::`[.glue`(x, notBytes)
18: x[notBytes]
17: enc2utf8(x)
16: glue:::as_glue.character(NextMethod())
15: glue:::as_glue(NextMethod())
14: glue:::`[.glue`(x, notBytes)
13: x[notBytes]
12: enc2utf8(x)
11: glue:::as_glue.character(res)
10: glue:::as_glue(res)
--------------
In TERR 4.5.0, base::enc2utf8() was revised to keep it from being redirected from "[" to glue:::[.glue. This prevents the runaway recursion.
In TERR 4.4.x, you will need to use glue 1.2.0 or glue 1.1.1 to prevent this issue. (TERR 4.4 used glue 1.1.1 in its basic compatibility testing.)
Use of CRAN packages:
User-contributed R packages from the open-source R community's CRAN repository (https://cran.r-project.org/) are available under separate open source software license terms and are not part of the TIBCO Spotfire product line. As such, user-contributed CRAN packages are not within the scope of your license for any TIBCO Spotfire product. User-contributed CRAN packages are not supported, maintained, or warranted in any way by TIBCO Software Inc. Download and use of CRAN packages is solely at your own discretion and subject to the free open source license terms applicable to each individual package.