positron icon indicating copy to clipboard operation
positron copied to clipboard

[Bug] Socket Timeout Error When Starting R with Positron

Open kmkamilkhel opened this issue 1 year ago • 2 comments
trafficstars

System Details: Positron and OS Details: Positron Version: 2024.07.0-125

Operating System: Windows 10 Pro, Version 20H2

Interpreter Details: R Version: R 4.4.1

Describe the Issue: I'm experiencing a socket connection timeout error when attempting to start R (version 4.4.1) within the Positron IDE. This issue consistently prevents the successful initialization of R sessions. Below are the error messages and system configurations related to the issue:

R 4.4.1 starting. Error: Socket connect timed out after 20 seconds "c:\Program Files\Positron\resources\app\extensions\positron-r\resources\ark\ark.exe" --connection_file C:\Users\kk\AppData\Local\Temp\kernel-79VBUu\connection.json --log C:\Users\kk\AppData\Local\Temp\kernel-79VBUu\kernel.log --startup-file "c:\Program Files\Positron\resources\app\extensions\positron-r\resources\scripts\startup.R" --session-mode console -- --interactive --no-restore-data Process exit code 1073741845

Log File Details: Here are some relevant excerpts from the log file located at C:\Users\kk\AppData\Local\Temp\kernel-79VBUu\kernel.log:

[2024-08-05 10:15:32] INFO: Starting R process... [2024-08-05 10:15:52] ERROR: Socket connection timed out. [2024-08-05 10:15:52] ERROR: Process exit code 1073741845 - STATUS_ACCESS_VIOLATION

kmkamilkhel avatar Aug 05 '24 07:08 kmkamilkhel

How was this R version installed?

Are you able to use it with other R front ends, such as RStudio?

Could you try again with trace-level logs enabled for R? You can turn these on here:

Image

jmcphers avatar Aug 05 '24 21:08 jmcphers

@jmcphers, thank you for looking into this issue. Below are the details and responses to your questions: R Version Installation Details: Installation Method: The R version 4.4.1 was installed using the official installer from CRAN. I downloaded the installer directly from CRAN's website and followed the standard installation process.

Installation Path: The installation path is the default location: C:\Program Files\R\R-4.4.1.

Environment Variables: I have verified that the R executable is correctly added to the system's PATH environment variable.

Compatibility with Other R Front Ends: RStudio: I am able to use R 4.4.1 successfully with RStudio without any issues. RStudio starts the R session without any socket timeout errors or connectivity problems.

Other Front Ends: I have also tested R with the base R GUI, and it runs without any problems.

Trace-Level Logs: I have enabled trace-level logging in Positron, and below are the relevant details from the log file:

Trace Log Excerpts:

R 4.4.1 starting. Error: Socket connect timed out after 20 seconds "c:\Program Files\Positron\resources\app\extensions\positron-r\resources\ark\ark.exe" --connection_file C:\Users\kk\AppData\Local\Temp\kernel-mJSG1T\connection.json --log C:\Users\kk\AppData\Local\Temp\kernel-mJSG1T\kernel.log --startup-file "c:\Program Files\Positron\resources\app\extensions\positron-r\resources\scripts\startup.R" --session-mode console -- --interactive --no-restore-data 2024-08-06T06:27:45.867416Z INFO Loaded connection information from frontend in C:\Users\kk\AppData\Local\Temp\kernel-mJSG1T\connection.json 2024-08-06T06:27:45.867464Z DEBUG Connection data: ConnectionFile { control_port: 53199, shell_port: 53886, stdin_port: 58536, iopub_port: 43750, hb_port: 62047, transport: "tcp", signature_scheme: "hmac-sha256", ip: "127.0.0.1", key: "80ce6d19824a565cf4d6913733d87998" } 2024-08-06T06:27:45.873921Z TRACE Binding to ZeroMQ 'Shell' socket at tcp://127.0.0.1:53886 at crates\amalthea\src\socket\socket.rs:45

Process exit code 1073741845

ZeroMQ Binding: The log indicates that there is an issue with binding to the ZeroMQ 'Shell' socket, suggesting a problem in establishing the connection.

Ports and IP: The connection uses ports on 127.0.0.1, and I've confirmed no conflicts with these ports using netstat.

Given these steps, I would appreciate any additional guidance or suggestions you might have to resolve this persistent issue. Is there a particular configuration or setting within Positron or R that I might have overlooked?

Thank you for your assistance!

kmkamilkhel avatar Aug 06 '24 06:08 kmkamilkhel

I am getting same and/or similar error message with Positron and Python interpreter on startup (at least the first message "Error: Socket connect timed out after 20 seconds". Copied from Positron Console. NOTE I have upgraded to Python 3.12.6!

Python 3.12.5 (Global) starting.
Error: Socket connect timed out after 20 seconds
C:\Users\JimCa\AppData\Local\Programs\Python\Python312\python.exe "c:\Program Files\Positron\resources\app\extensions\positron-python\python_files\positron\positron_language_server.py" -f C:\Users\JimCa\AppData\Local\Temp\kernel-DWBqVv\connection.json --logfile C:\Users\JimCa\AppData\Local\Temp\kernel-DWBqVv\kernel.log --loglevel error --session-mode console 
Process exit code 1 
>>>

For example when I start Python in Windows Terminal:

PS D:\Fdrive\Quarto\Population> python
Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep  6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World!")
Hello World!
>>> quit()

JimCallahanOrlando avatar Sep 23 '24 18:09 JimCallahanOrlando

Contents of: C:\Users\JimCa\AppData\Local\Temp\kernel-DWBqVv/kernel.log

*** Log started at Mon 09/23/2024 13:03:49.42 
*** Command line: 
C:\Users\JimCa\AppData\Local\Programs\Python\Python312\python.exe "c:\Program Files\Positron\resources\app\extensions\positron-python\python_files\positron\positron_language_server.py" -f C:\Users\JimCa\AppData\Local\Temp\kernel-DWBqVv\connection.json --logfile C:\Users\JimCa\AppData\Local\Temp\kernel-DWBqVv\kernel.log --loglevel error --session-mode console 
*** Log ended at Mon 09/23/2024 13:03:52.67 
Process exit code 1 

Contents of: C:\Users\JimCa\AppData\Local\Temp\kernel-DWBqVv/connection.json

{"control_port":48640,"shell_port":50829,"stdin_port":53500,"iopub_port":46801,"hb_port":48854,"signature_scheme":"hmac-sha256","ip":"127.0.0.1","transport":"tcp","key":"ea566079480a0bbe1ae17ce554fe6d3a"}

Errors reported for imports on lines 12, 13, 14 C:\Program Files\Positron\resources\app\extensions\positron-python\python_files\positron\positron_language_server.py

12 from positron_ipykernel.positron_ipkernel import PositronIPKernelApp
13 from positron_ipykernel.positron_jedilsp import POSITRON
14 from positron_ipykernel.session_mode import SessionMode
[{
	"resource": "/C:/Program Files/Positron/resources/app/extensions/positron-python/python_files/positron/positron_language_server.py",
	"owner": "python",
	"code": {
		"value": "reportMissingImports",
		"target": {
			"$mid": 1,
			"external": "https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportMissingImports",
			"path": "/microsoft/pyright/blob/main/docs/configuration.md",
			"scheme": "https",
			"authority": "github.com",
			"fragment": "reportMissingImports"
		}
	},
	"severity": 4,
	"message": "Import \"positron_ipykernel.positron_ipkernel\" could not be resolved",
	"source": "Pyright",
	"startLineNumber": 12,
	"startColumn": 6,
	"endLineNumber": 12,
	"endColumn": 42
}]
[{
	"resource": "/C:/Program Files/Positron/resources/app/extensions/positron-python/python_files/positron/positron_language_server.py",
	"owner": "python",
	"code": {
		"value": "reportMissingImports",
		"target": {
			"$mid": 1,
			"external": "https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportMissingImports",
			"path": "/microsoft/pyright/blob/main/docs/configuration.md",
			"scheme": "https",
			"authority": "github.com",
			"fragment": "reportMissingImports"
		}
	},
	"severity": 4,
	"message": "Import \"positron_ipykernel.positron_jedilsp\" could not be resolved",
	"source": "Pyright",
	"startLineNumber": 13,
	"startColumn": 6,
	"endLineNumber": 13,
	"endColumn": 41
}]
[{
	"resource": "/C:/Program Files/Positron/resources/app/extensions/positron-python/python_files/positron/positron_language_server.py",
	"owner": "python",
	"code": {
		"value": "reportMissingImports",
		"target": {
			"$mid": 1,
			"external": "https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportMissingImports",
			"path": "/microsoft/pyright/blob/main/docs/configuration.md",
			"scheme": "https",
			"authority": "github.com",
			"fragment": "reportMissingImports"
		}
	},
	"severity": 4,
	"message": "Import \"positron_ipykernel.session_mode\" could not be resolved",
	"source": "Pyright",
	"startLineNumber": 14,
	"startColumn": 6,
	"endLineNumber": 14,
	"endColumn": 37
}]

JimCallahanOrlando avatar Sep 23 '24 19:09 JimCallahanOrlando

@JimCallahanOrlando Do you mind adding this info to #3779? We do believe there are different problems underlying these problems for R and Python.

juliasilge avatar Sep 24 '24 16:09 juliasilge

I get this issue sometimes as well. Restarting Positron usually helps. Though I have had one instance where that does not work and then I switch back to R Studio.

victorfeagins avatar Aug 06 '25 19:08 victorfeagins

My data science time this August is devoted to Orange County Redistricting 2025 using other (specialized, non-Posit) tools.

Unfortunately, a hardware issue forced me to begin moving to a new daily driver PC, so I moved my data and installed the latest versions of all software including R, Python, and Positron. I was impressed by Sara Altman's Posit YouTube video, "A Brief Tour of Positron" , especially beginning at timestamp 1:52 where she describes the "Interpreter Picker". https://www.youtube.com/watch?v=4Ir_HX4riHw

I briefly tried Positron's interpreter picker on my new Windows 11 machine with the version of Python I installed from the Microsoft Store and R downloaded from a CRAN mirror. I was delighted that both R & Python were found easily. In response to the YouTube video, I commented:

@jimcallahan448 9 days ago Impressive. Glad they showed how to select/identify the interpreter— that was something I had an issue with a while ago. Clever. Showing Python’s implementation of ggplot.

But then my attention returned to fighting the Windows 11 Pro Microsoft OneDrive default and installing other software, so I did not complete any further testing or data science work using Positron. So, it was a very quick & basic test using a clean install. I don't know the transferability of the test results, for example how it would have performed on my messy 7 years old daily driver Windows 10 PC with its numerous uninstalls, reinstalls, paths and environments.

@Julia Silge feel free to move my comments (with or without attribution) wherever you see fit on GitHub.

Jim Callahan

On Wed, Aug 6, 2025 at 3:02 PM Victor Feagins @.***> wrote:

victorfeagins left a comment (posit-dev/positron#4233) https://github.com/posit-dev/positron/issues/4233#issuecomment-3161267193

I get this issue sometimes as well. Restarting Positron usually helps. Though I have had instances where that does not work and then I switch back to R Studio.

— Reply to this email directly, view it on GitHub https://github.com/posit-dev/positron/issues/4233#issuecomment-3161267193, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7QNKSVJRHL3MOXYJJRGZL3MJGN7AVCNFSM6AAAAACDI3MTA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNRRGI3DOMJZGM . You are receiving this because you were mentioned.Message ID: @.***>

JimCallahanOrlando avatar Aug 06 '25 20:08 JimCallahanOrlando