-
Notifications
You must be signed in to change notification settings - Fork 969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console log not being rendered properly (Encoding issue) #3442
Comments
Very much reproducible — https://build.gocd.io/go/tab/build/detail/gocd-docs.go.cd-master/9/Build/1/build_job |
I've tried without success to reproduce this locally. I suspect it will never happen on MacOS X as the default is always UTF-8. We must be changing the encoding before sending the response because the file is valid UTF-8 (according to iconv). I'll dig into this some more. |
That's werid. I was seeing junk chars instead of the fancy npm tree on the URL I pasted in the comment before. I suspect something changed with chrome. Next time, I'll be sure to grab a screenshot if I come across this. |
@ketan there might be something more to it. I'm on Chrome Version 57.0.2987.133 (64-bit). I see junk characters with the URL, but not when I download the raw output and drop it into my dev instance... Exactly the same file, same browser, but different platform. I still think there's an underlying platform encoding issue. |
Kidding me — I see junk on that page now. If it helps, here are the request/response headers: Clearly mentioning the encoding as utf-8. I'm using chrome beta and the user-agent header contains the version To be doubly sure, I did a "copy as curl" and here's what I see in my terminal — I'm beginning to suspect that the server is doing something funny. I've dumped the output of "copy as curl" in a gist at https://gist.github.com/ketan/4cfaa5e2a797e216ff44854197569d9d. |
Did you rsync/scp that file over? I suspect we might be fudging the console
log between reading it, and sending it over the wire.
…On Wed, May 10, 2017 at 4:49 PM marques-work ***@***.***> wrote:
Furthermore, looking at the actual XHR response, the data comes back
differently between dev instance and build.gocd.io -- the special
characters are garbled.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3442 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAApZtMULMOh0TtCEGSik7TyDEEtUQHFks5r4Z0lgaJpZM4NNwjj>
.
|
@ketan no, I just did a save from the browser. This sounds very Heisenbergian :). I'll try that. |
@ketan, well, actually I realized that I can't try it - I don't think I have access to the machines. |
@ketan Also interesting XHR response, requesting log as an artifact:$j.ajax({url: "https://build.gocd.io/go/files/gocd-docs.go.cd-master/9/Build/1/build_job/cruise-output/console.log", type: "GET"}).done(console.log)
XHR response, using the polling request:$j.ajax({url: "https://build.gocd.io/go/files/gocd-docs.go.cd-master/9/Build/1/build_job/cruise-output/console.log?startLineNumber=0", type: "GET"}).done(console.log)
Grabbing the log as an artifact doesn't do any string interpretation, whereas hitting the console log polling endpoint does this: // ConsoleService.java - getConsoleOut() method, lines 67 - 75
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String consoleLine;
while (null != (consoleLine = reader.readLine())) {
if (lineNumber >= startingLine) {
builder.append(consoleLine);
builder.append(FileUtil.lineSeparator());
}
lineNumber++;
} InputStreamReader must be choosing an encoding other than UTF-8, which likely yields the garbled characters. Of course, once it becomes a String in Java, it's UTF-8, which is why we see that in the response headers, after it's turned to shit :). I would propose changing the line to this: BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); so that these characters are preserved. I do realize there was some prior discussing about forcing UTF-8, so maybe it's time to revisit? |
My guess is that |
Update: Barrow scp'd the console log to me and everything looks fine there, so it's written to the filesystem properly. |
I believe it was you who changed it in d33ffcd. So the console log on the agent is read in the default charset, and is treated as a binary until it is written to the disk on the server. |
Reopening for @rajiesh or @ankitsri11 to take a quick stab. |
There are only 2 options here —
The first one, obviously is a lot simpler to implement and will likely work for most of the users with no issues whatsoever. Right now, there's an impedance mismatch, between the encoding on the agent and on the server, which may cause issues and errors in case the encodings are incompatible. |
Gotta love it when I introduce hard to pin bugs :). Thanks for merging the PR. I see that prior to that change, Regarding the 2 options, I'd fall into the first category -- that of the UTF-8 opinion. |
Is this being resourced? It appears to be related to an issue that I raised last week (which is preventing me from upgrading to any newer releases of GoCD). In my case, the console log no longer updates upon encountering non-ASCII characters. |
@BrewRunner No one is currently looking at #3926. @ankitsri11 might take a look at reproducing both #3930 and #3926 in the coming days, but not sure when at this point. |
Closing as dup of #3926 |
Issue Type
Summary
Environment
Could reproduce this on build.gocd.io. Not reproducible on my laptop.
Steps to Reproduce
Expected Results
Expected the tree structure to show up
Actual Results
See some gibberish instead
![screen shot 2017-05-02 at 11 58 22 am](https://cloud.githubusercontent.com/assets/1046342/25606403/b5db95c4-2f2e-11e7-81b6-f147fe5e3f97.png)
console.log.txt
The text was updated successfully, but these errors were encountered: