[R-SIG-Mac] tcltk causes help() to hang in R 4.2.0 on macOS

John Fox j|ox @end|ng |rom mcm@@ter@c@
Wed Jun 8 18:36:06 CEST 2022


Dear Thomas,

Thanks for this additional information.

I added some of my own defensive code to the development version of the 
Rcmdr package, to set the "help_type" option to "text" for macOS. I'll 
modify that to all non-Windows platforms, and also include this in the 
CRAN version of the package.

I currently test on macOS and Windows systems but when I have a chance 
will get a Linux system working as well.

Best,
  John

On 2022-06-08 12:16 p.m., Tomas Kalibera wrote:
> For reference, this problem is not macOS specific, it also exists on 
> Linux (but not on Windows which use a different code path) and the core 
> problem is how to prevent re-entrant execution of R event handlers when 
> run from the R/tcltk event loop, itself running from an R event handler.
> 
> R-patched now contains a defensive work-around from Simon.
> 
> We have added a more efficient and cleaner fix to R-devel, but there is 
> some risk of breakage: this form is "the documented way" but didn't work 
> on some systems ~22 years ago. So it would be great if people using 
> Tcl/Tk in R on Unix, and particularly those with rarely used window 
> managers, could test their applications or the tcltk package demos and 
> report any issues well before the next release.
> 
> Thanks
> Tomas
> 
> On 5/30/22 01:27, John Fox wrote:
>> Dear Simon,
>>
>> Thank you for addressing this problem so promptly.
>>
>> Best,
>>  John
>>
>> On 2022-05-29 6:51 p.m., Simon Urbanek wrote:
>>> Actually, I take back the reference to the commit - the deadlock is 
>>> true, and removing the line is a work-around, but r78421 was not 
>>> necessarily the regression. The issue seems to be caused by a 
>>> combination of Tcl/Tk and KaTeX (the latter causes the browser to 
>>> issue multiple parallel http-requests and the former causes the 
>>> deadlock in its event loop) which has not been there in earlier R 
>>> versions.
>>>
>>> Cheers,
>>> Simon
>>>
>>>
>>>> On 30/05/2022, at 10:09 AM, Simon Urbanek 
>>>> <simon.urbanek using r-project.org> wrote:
>>>>
>>>> John,
>>>>
>>>> thanks, this is a regression caused by r78421 (deadlock when TclTk's 
>>>> event loop is called in http processing). Removing L875 in 
>>>> src/modules/internet/Rhttpd.c restores the previous behavior, but 
>>>> the underlying problem is more complex and will require more 
>>>> investigation.
>>>>
>>>> Cheers,
>>>> Simon
>>>>
>>>>
>>>>> On 29/05/2022, at 5:36 AM, John Fox <jfox using mcmaster.ca> wrote:
>>>>>
>>>>> Dear R-sig-mac list members,
>>>>>
>>>>> I've discovered that loading the tcltk package apparently causes R 
>>>>> 4.2.0 (including the current patched version) to hang on an M1 Mac.
>>>>>
>>>>> Try, e.g.,
>>>>>
>>>>> library("tcltk")
>>>>> help("lm")
>>>>>
>>>>> My session info:
>>>>>
>>>>> ------- snip -------
>>>>>
>>>>>> sessionInfo()
>>>>> R version 4.2.0 Patched (2022-05-28 r82413)
>>>>> Platform: aarch64-apple-darwin20 (64-bit)
>>>>> Running under: macOS Monterey 12.3.1
>>>>>
>>>>> Matrix products: default
>>>>> BLAS: 
>>>>> /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib 
>>>>>
>>>>> LAPACK: 
>>>>> /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib 
>>>>>
>>>>>
>>>>> locale:
>>>>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>>>>
>>>>> attached base packages:
>>>>> [1] tcltk     stats     graphics  grDevices utils datasets  methods
>>>>> [8] base
>>>>>
>>>>> loaded via a namespace (and not attached):
>>>>> [1] compiler_4.2.0
>>>>>
>>>>> ------- snip -------
>>>>>
>>>>> Some additional details: The problem occurs both in the R macOS 
>>>>> console and, if options(help_type="html"), when R is run in a 
>>>>> terminal window on macOS, but not when options(help_type="text"). 
>>>>> The former is the default in the Mac R console, the latter when R 
>>>>> is run in a terminal.
>>>>>
>>>>> The problem is apparently new in R 4.2.0 -- it doesn't, e.g., occur 
>>>>> in R 4.1.3. My apologies for not turning it up earlier.
>>>>>
>>>>> I discovered the problem when accessing help in the Rcmdr GUI, 
>>>>> which uses tcltk, caused R to hang.
>>>>>
>>>>> Has anyone else encountered this problem?
>>>>>
>>>>> Best,
>>>>> John
>>>>> -- 
>>>>> John Fox, Professor Emeritus
>>>>> McMaster University
>>>>> Hamilton, Ontario, Canada
>>>>> web: https://socialsciences.mcmaster.ca/jfox/
>>>>>
>>>>> _______________________________________________
>>>>> R-SIG-Mac mailing list
>>>>> R-SIG-Mac using r-project.org
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>>
>>>>
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac using r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>
>>>
-- 
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://socialsciences.mcmaster.ca/jfox/



More information about the R-SIG-Mac mailing list