ERR_INVALID_CHUNKED_ENCODING in Chrome

Hi!

I’m using ServiceStack on Mono: 4.8.0.

Recently, Google Chrome is giving me these errors in the console window:

GET http://localhost:8080/event-stream?channel=home,events&t=1500371276974 net::ERR_INVALID_CHUNKED_ENCODING

ServerEvents Client won’t work either.

The strange thing is, if i run my application on regular .net 4.5 instead of by Mono Runtime, i don’t have these errors.
Also: should i use the Safari browser, is does work again. (regardless of host)

Any change you came across this before?

Regards,

Which version of ServiceStack are you using? What operating system do you use to run mono? How do you run mono (xsp, self-hosting, fast-cgi)? And on which OS do you open chrome browser?

Also can you provide a standalone solution which we can run and see the issue?

Which version of ServiceStack are you using?
4.5.12
What operating system do you use to run mono?
Both Mono on Mac as Mono on Linux
How do you run mono (xsp, self-hosting, fast-cgi)?
Self hosting (AppSelfHostBase)
And on which OS do you open chrome browser?
Both Windows and Mac Osx

Also can you provide a standalone solution which we can run and see the issue?
I can see if i can put something together…

I’m not sure you can download it like this; but here is a GOogleDrive link to a Simple Selfhosted project.

This also gives these errors.

Regards,

I opened and ran the project on mono (Ubuntu 16.04) . In chrome I see these message in console, but can’t get net::ERR_INVALID_CHUNKED_ENCODING

Mono version:

Mono JIT compiler version 4.8.0 (Stable 4.8.0.520/8f6d0f6 Wed Mar 15 16:18:35 UTC 2017)

Should I make some specific request to get the error?

Oh, ik got the errors pretty fast. Maybe try reloading the page a few times?

Strange!!?

No specific request, just opening and refreshing the default page should do…

If I refresh the page I get the error ERR_INVALID_CHUNKED_ENCODING but only once, because connection is interrupted. After couple of seconds, it is restored and I get message events without errors like as before reload.

Maybe you have some proxy settings in chrome? And do you have this issue only in chrome? Do Firefox or IE/Edge raise this error?

Well, if i refresh the page; it seems to be hanging in this error loop or something , it won’t come out of. Also you can see there is a onConnect message everytime,so the connection looks like its being dropped or something.

i’m running Chrome 59.0.3071.115 (Officiële build) (64-bits)

Firefox works Fine, also; Safari works just fine.

I don’t get it… i will search some more on Chrome. I don’t have proxy settings, it happens on all Chrome browsers i tried so far. (Mac/Windows on Parallels) etc…

What if run chrome browser from another machine? Does it produce the same error?

I’ll try to run both the solution and chrome on Mac, maybe this configuration will allow to reproduce the issue.

I was able to reproduce this issue when app and chrome both run on mono at OS X. I am trying to determine is it a mono or chrome issue and how it can be avoided.

okay great, well… you know what i mean.

i’m curious to see what the problem is.

Hey a lot of stability and performance issues are due to Mono and aren’t fixable within the framework, you should be planning your migration to .NET Core.

1 Like

I understand, i am actually planning it.
However; it’s not done just yet, and this is a current problem (only in Chrome)…

From what I found by analyzing packets between chrome and the running sample HttpListener on mono does not always correctly end the chunk when send it to the client. It sometimes adds the length of the next chunk to the end of the current chunk and then connection is dropped. Most of browser ignores these erroneous data, but chrome is more strict and assumes that the new chunk is started and should be completed in this connection. When it does not receive the data it shows this error message.
If switch from AppSelfHostBase to XSP the error is gone and ServerEvents works correctly with chrome on OS X. I’d recommend to switch to nginx+hyperfastcgi from AppSelfHost if you can’t move to .NET Core yet.