AvaloniaRider icon indicating copy to clipboard operation
AvaloniaRider copied to clipboard

Socket error while session is still alive

Open rstm-sf opened this issue 3 years ago • 13 comments

Hello!

When a plugin sends a message via avalonia-remote that the server cannot parse, an error occurs that is not shown in the preview

ERROR | AvaloniaPreviewerSessionController | Socket error while session is still alive
java.net.SocketException: Connection reset
	at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
	at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:200)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:170)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readBytes(BsonStreamReader.kt:26)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readMessage(BsonStreamReader.kt:30)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSession.processSocketMessages(AvaloniaPreviewerSession.kt:60)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSessionController$executePreviewerAsync$sessionJob$1.invokeSuspend(AvaloniaPreviewerSessionController.kt:221)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
INFO  | AvaloniaPreviewerSessionController | Socket listener has been terminated first

rstm-sf avatar Aug 30 '20 09:08 rstm-sf

Rider Version: 2020.3.2 OS: ubuntu 20.10 Avalonia: 0.10.0-rc1

Socket error while session is still alive

java.io.EOFException
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:202)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:170)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readBytes(BsonStreamReader.kt:26)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readMessage(BsonStreamReader.kt:30)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSession.processSocketMessages(AvaloniaPreviewerSession.kt:60)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSessionController$executePreviewerAsync$sessionJob$1.invokeSuspend(AvaloniaPreviewerSessionController.kt:218)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

ghost avatar Jan 19 '21 02:01 ghost

@TheForgetTime hello, can you tell what actions preceded this?

rstm-sf avatar Jan 19 '21 17:01 rstm-sf

@TheForgetTime hello, can you tell what actions preceded this?

compile the project and double click on the xaml file

ghost avatar Jan 27 '21 10:01 ghost

Hi @ForNeVeR

I see the same issue in Rider. I think it is not a big deal as everything compiles as expected. If you need any information from my side I would be glad to help.

EXqzVHyuid

By the way: Thank you for the great plugin 👍

timunie avatar Nov 16 '21 14:11 timunie

Hello! Today I have the same error after switching solution to other in current window. Idk will it affects stability / crashes or not, but my IDE is still working properly, and the preview works fine too. I'm using Rider 2021.3.2 build RD-213.6461.51, my operation system is Windows 10, AvaloniaUI framework version is 0.10.11 bleeding edge. The AvaloniaRider plugin version is latest from marketplace (1.0.0.1540867288, installed on 25.01.2022)

image

appleneko2001 avatar Jan 25 '22 06:01 appleneko2001

Getting a similar error. All I did was install the plugin and I tried to launch the preview from the Full FuncUI project template.

Rider Version: 2022.1.1 (Build #RD-221.5591.20) OS: Arch Linux (x86_64 Linux 5.17.4-arch1-g14-1) AvaloniaRider: 1.0.0.2140933513 Avalonia: 0.10.12 Avalonia.FuncUI: 0.5.0

Socket error while session is still alive

java.io.EOFException at java.base/java.io.DataInputStream.readFully(DataInputStream.java:202) at java.base/java.io.DataInputStream.readFully(DataInputStream.java:170) at me.fornever.avaloniarider.bson.BsonStreamReader.readBytes(BsonStreamReader.kt:26) at me.fornever.avaloniarider.bson.BsonStreamReader.readMessage(BsonStreamReader.kt:30) at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSession.processSocketMessages(AvaloniaPreviewerSession.kt:66) at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSessionController$executePreviewerAsync$sessionJob$1.invokeSuspend(AvaloniaPreviewerSessionController.kt:274) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) at java.base/java.lang.Thread.run(Thread.java:829)

JosephFerano avatar May 13 '22 11:05 JosephFerano

I get the same error, but for me the XAML preview doesn't work (although it did previously)

Rider 2022.1.2 (Build #RD-221.5787.36) AvaloniaRider 1.0.0.2140933515 Avalonia 0.10.18 Avalonia.ReactiveUI 0.10.18 On an up-to-date Linux Manjaro 21.3

Vaguely different line numbers from @JosephFerano, but otherwise looks the same.

Socket error while session is still alive

java.io.EOFException
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:202)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:170)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readBytes(BsonStreamReader.kt:26)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readMessage(BsonStreamReader.kt:30)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSession.processSocketMessages(AvaloniaPreviewerSession.kt:64)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSessionController$executePreviewerAsync$sessionJob$1.invokeSuspend(AvaloniaPreviewerSessionController.kt:299)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)

kroltan avatar Aug 27 '22 21:08 kroltan

And what does the previewer log say?

ForNeVeR avatar Aug 27 '22 21:08 ForNeVeR

I don't know where to view that, could you clarify?

kroltan avatar Aug 27 '22 23:08 kroltan

Just open the Avalonia tool window, it will show the logs.

ForNeVeR avatar Aug 28 '22 09:08 ForNeVeR

Oh right, I didn't know about that window.

Turns out it was an issue in my application code, not the plugin's fault. I assumed that because my application is being developed only for desktops, that meant that the ApplicationLifetime would have always been IClassicDesktopStyleApplicationLifetime, but apparently a different lifetime is used for design-time, so it was crashing. I fixed that and rebuilt the project and now the previews work fine!

Sorry for the noise.

kroltan avatar Aug 28 '22 12:08 kroltan

This is alright, and the discoverability of a said output window is still an unresolved problem within the plugin.

ForNeVeR avatar Aug 28 '22 12:08 ForNeVeR

Getting this on latest Rider as well:

Socket error while session is still alive

java.net.SocketException: Connection reset
	at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:323)
	at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
	at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
	at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:201)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:172)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readBytes(BsonStreamReader.kt:26)
	at me.fornever.avaloniarider.bson.BsonStreamReader.readMessage(BsonStreamReader.kt:30)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSession.processSocketMessages(AvaloniaPreviewerSession.kt:64)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSessionController$executePreviewerAsync$sessionJob$1.invoke(AvaloniaPreviewerSessionController.kt:314)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSessionController$executePreviewerAsync$sessionJob$1.invoke(AvaloniaPreviewerSessionController.kt:311)
	at com.intellij.openapi.rd.util.RdCoroutinesUtilKt$startSyncIOBackgroundAsync$1.invokeSuspend(RdCoroutinesUtil.kt:109)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)

Log is follows:

"C:\Program Files\dotnet\dotnet.exe" exec --runtimeconfig "D:\PATH_TO_BIN\ProjectName.runtimeconfig.json" --depsfile "D:\PATH_TO_BIN\ProjectName.deps.json" C:\Users\user.nuget\packages\avalonia\11.0.0-preview4\buildTransitive..\tools\netcoreapp2.0\designer\Avalonia.Designer.HostApp.dll --transport tcp-bson://127.0.0.1:55102/ --method avalonia-remote "D:\PATH_TO_BIN\ProjectName.dll" Obtaining AppBuilder instance from Project.Program.BuildAvaloniaApp Initializing application in design mode Sending StartDesignerSessionMessage Process terminated with exit code 0

If this is caused by an exception in my code, it would be great to see the stacktrace down to that exception in order to get some hint of what could go wrong.

Rider 2022.3 AvaloniaRider 1.0.0.2140933527 Avalonia 11.0.0-preview.4

DmitriyYukhanov avatar Dec 08 '22 11:12 DmitriyYukhanov