Carbon closes connection unexpectedly resulting in net::ERR_CONNECTION_CLOSED error
See original GitHub issueHi,
I was trying to process a bash scripts file and the carbon-now-cli always shows that
Error: Sending code to https://carbon.now.sh went wrong
I uploaded my script here, and please try the following command on it.
First, carbon-now colortest
, does’t work.
There are 75 lines in the file, and changing the the -e
option to a value smaller than or equal to 61, it will work.
Then, without modifying the -e
, try changing the values for -s
option, I find that the CLI would stop working if -s
is greater than or equal to 5.
The correspondent code blocks that I suspect to be the cause of the bug are:
Line 4 to line 6:
colortest_usage () {
echo -e "Usage: colortest [[-v|--verbose] | [-a|--all] | [-h|--help]]\n\nPrint out colors available in this terminal emulator. The default output is a short list of colors. If -v or --verbose is specified, a table containing all combination of background and foreground colors is displayed. Alternatively, if -a or -all is specified, then both short list and the detailed table would be displayed.\n\nNote that there should be no argument to this programme.\n -v, --verbose\t displays a table with detailed table of combinations of colors.\n -a, --all \t displays both brief and detailed results.\n -h, --help \t displays this help."
}
And line 62 to line 71:
while [[ "$#" > 0 ]]; do
case "$1" in
-h|--help) colortest_usage;;
-v|--verbose) colortest_long;;
-a|--all) colortest_short; colortest_long;;
--) colortest_short;;
*) echo "$0: Error(1): This function doesn't accept any argument." >&2 | logger; colortest_usage;unset -f colortest_usage colortest_short colortest_long; option; return 1;;
esac
shift
done
It seems that as long as I’m not asking carbon-now-cli
to process both code blocks, then it works fine.
Please take a look. Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
As explained thoroughly in https://stackoverflow.com/a/417184 , there is no character limit in URLs in theory, but most servers and browsers defined their own limits.
I guess Puppeteer is not the problem here, but the carbon now server. As you can see in the link above, puppeteer would likely have it’s limits about over 32k.
Also a “connection closed” error sounds more like a carbon issue to me, meaning the server closed the connection unexpectedly.
Update: Tried it! It’s a carbon now issue. If you reload the page after pasting your code in the web app, you will get the same error.
Hi @lebensterben, thanks for the very detailed report on this. 🙂 Also, nice username. 😊
I was able to reproduce this issue for your particular use case and started investigating. Debugged for quite a bit and ended up noticing that it has nothing to do with certain special characters or your file in particular.
It has something to do with the length of the URL that gets produced and Puppeteer tries to open.
The longer the file you’re parsing, the longer the URL (which is ok and completely logical). But seemingly long URLs (above
~6510
characters in total length) lead to anet::ERR_CONNECTION_CLOSED
on Puppeteers end. 🤔Having a
foo.txt
with6330x
the lettera
will fail with this error:…which is the same error I was getting for your file. Or any big file for that matter.
I couldn’t find a Puppeteer issue for long URLs at first glance. Will likely file a report and see what the feedback is. This has a high priority atm because it kind of limits the CLI to small-ish files… and your file wasn’t even that big with 75 LOC.