Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Battery Historian not uploading bugreport #185

Open
nandanthusu opened this issue Jul 8, 2019 · 24 comments
Open

Battery Historian not uploading bugreport #185

nandanthusu opened this issue Jul 8, 2019 · 24 comments

Comments

@nandanthusu
Copy link

nandanthusu commented Jul 8, 2019

I have run;
docker run -p 19991:9999 gcr.io/android-battery-historian/stable:3.0 --port 9999

and i get the output below when I go to "localhost:19991" and try to upload a bugreport(both zip and txt);
Nandans-MacBook-Pro:~ nandant$ docker run -p 19991:9999 gcr.io/android-battery-historian/stable:3.0 --port 9999
2019/07/08 17:48:44 Listening on port: 9999
2019/07/08 17:52:43 Trace starting analysisServer processing for: GET
2019/07/08 17:52:43 Trace finished analysisServer processing for: GET
2019/07/08 17:52:45 Trace starting analysisServer processing for: GET
2019/07/08 17:52:45 Trace finished analysisServer processing for: GET

when I try to upload the report on the screen nothing gets updated and the 0->100% bar does not show up. It seems through the terminal Battery Historian is receiving the bug report but the localhost:19991 is not updating with the upload

I have tried restarting my Docker, restarting my computer, stopping and restarting the docker run command, as well as trying multiple different bug reports that have worked in the past.

@lquinn
Copy link

lquinn commented Jul 8, 2019

I have the same problem with a Battery Historian install that was working fine last week. My browser's console shows this:

The resource from “http://www.gstatic.com/external_hosted/d3/v4/d3.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff). localhost:9876
Loading failed for the <script> with source “http://www.gstatic.com/external_hosted/d3/v4/d3.js”. localhost:9876:35:1
ReferenceError: d3 is not defined historian-optimized.js:270:1

@nandanthusu
Copy link
Author

nandanthusu commented Jul 8, 2019

@lquinn

I too have the same issues with d3.js:

Uncaught ReferenceError: d3 is not defined
at historian-optimized.js?ver=2:270

@SylvainHunault
Copy link

SylvainHunault commented Jul 8, 2019

I had the same issue.
Building the code and running it myself worked for me as a workaround (I followedt he readme). Also followed issue 183 for completing build.

@qsjiang
Copy link

qsjiang commented Jul 8, 2019

It seems gstatic removed the d3.js graph library file which is required by the battery historian's javascript.

Does anyone know if there is a person we could contact on the gstatic side?

@jocelyndang @kwadkore

@qsjiang
Copy link

qsjiang commented Jul 8, 2019

Here is another work around for anyone who really need this thing working:

  • redirect http://www.gstatic.com to your local apache server. By adding the following line to your /etc/hosts file.

127.0.0.1 www.gstatic.com

You might have to download jquery.form.min.js and bootstrap as well since they are also served from gstatic.

Once that is done I got the docker image working locally on my machine.

@ZiglioUK
Copy link

ZiglioUK commented Jul 9, 2019

Alternatively you can edit directly battery historian's docker container.
While it's running, run docker ps to get its name.
Then run docker exec -it <NAMES> bash.
Install vim apt-get update && apt-get install vim
Edit base.html vim templates/base.html
Change line 45 from
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>
to
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
Then restart the container docker restart <CONTAINER ID>.

Voila! I'm not entirely sure how to make this change permanent. I guess one has to run the local copy of the container instead of pulling it from the web.

@Jasper-1024
Copy link

Jasper-1024 commented Jul 10, 2019

Alternatively you can edit directly battery historian's docker container.
While it's running, run docker ps to get its name.
Then run docker exec -it <NAMES> bash.
Install vim apt-get update && apt-get install vim
Edit base.html vim templates/base.html
Change line 45 from
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>
to
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
Then restart the container docker restart <CONTAINER ID>.

Voila! I'm not entirely sure how to make this change permanent. I guess one has to run the local copy of the container instead of pulling it from the web.

it work,but for some reason ,the line need changed on my container was that

<script type="text/javascript" src="//www.gstatic.com/external_hosted/d3/v4/d3.js"></script>

just chang it into

<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>

then restart docker.

@qsjiang
Copy link

qsjiang commented Jul 10, 2019

Alternatively you can edit directly battery historian's docker container.
While it's running, run docker ps to get its name.
Then run docker exec -it <NAMES> bash.
Install vim apt-get update && apt-get install vim
Edit base.html vim templates/base.html
Change line 45 from
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>
to
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
Then restart the container docker restart <CONTAINER ID>.
Voila! I'm not entirely sure how to make this change permanent. I guess one has to run the local copy of the container instead of pulling it from the web.

it work,but for some reason ,the line need changed on my container was that

<script type="text/javascript" src="//www.gstatic.com/external_hosted/d3/v4/d3.js"></script>

just chang it into

<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>

then restart docker.

Yes. The url needs to be replaced is "www.gstatic.com".

Not <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>

@ZiglioUK
Copy link

ZiglioUK commented Jul 10, 2019

oops, sorry, I copied the line perhaps after changing it

@njulemon
Copy link

Thanks a lot !
Worked for me.

@nandanthusu
Copy link
Author

@ZiglioUK The aforementioned response to your solution worked thank you.

I will leave this open until there is a permanent solution to this

@ravidattani
Copy link

facing same issue, it was working fine day before yesterday.

Does starting docker image pull changes everytime?

@ZiglioUK
Copy link

ZiglioUK commented Jul 11, 2019

I think it depends on how you start it. You can run the local instance you've pulled and modified, not sure how though

@exe7400
Copy link

exe7400 commented Jul 11, 2019

I did not do it all, when I restart docker. nothing happens, when I try again I find that the file has not been changed in line 45

@exe7400
Copy link

exe7400 commented Jul 11, 2019

is work tank you very much I forget cmd : docker restart

@Alejandro-pucci
Copy link

Is this related to www.bathist.ef.lc not working for a few days?

@Alejandro-pucci
Copy link

I meant: https://bathist.ef.lc/

@ZiglioUK
Copy link

ZiglioUK commented Jul 14, 2019

I meant: https://bathist.ef.lc/

Yes, of course. If you open the developer tools you'll see that d3.js fails to load

@bobobo1618
Copy link

@Alejandro-pucci I've updated it with the fix, should work now.

@Alejandro-pucci
Copy link

It does work now. Thank you!

@nadiamoe
Copy link

I'm extremely puzzled about this. The code in this repo does not contain the failing gstatic url, but a working one:

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>

In addition, seems like the gstatic url was neither set not removed from that file (according to git blame), so it really makes me wonder what exactly is the docker image they are hosting and why does it contain code that is not on the repo.

@sfunke
Copy link

sfunke commented Sep 15, 2019

For anyone interested, I have created a customized Docker image based on the original one, with the path to the Javascript library modified (taken from base.html from the repo):

https://hub.docker.com/r/sfunke/battery-historian

Dockerfile:

FROM gcr.io/android-battery-historian/stable:3.0

# replacing path of some JS Lib in base.html because of 404
# https://github.com/google/battery-historian/issues/185

RUN sed -i s#//www.gstatic.com/external_hosted/d3/v4/d3.js#//cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js#g /gopure/src/github.com/google/battery-historian/templates/base.html

@kangting666
Copy link

I meant: https://bathist.ef.lc/

Yes, of course. If you open the developer tools you'll see that d3.js fails to load

I meant: https://bathist.ef.lc/

Yes, of course. If you open the developer tools you'll see that d3.js fails to load

it is not working again...

@bobobo1618
Copy link

@kangting666 this isn't a place to complain about bathist.ef.lc. That site isn't at all affiliated with Google or this repository. It just runs the code here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests