Page MenuHomeSoftware Heritage

web app initialized twice(?)
Closed, MigratedEdits Locked

Description

Upon start, the webapp prints its own initialization message twice, e.g.:

timira ➜  swh-web-ui git:(master) bin/swh-web-ui
SWH Web UI available at http://127.0.0.1:6543/
debug: True
SWH Web UI available at http://127.0.0.1:6543/
debug: True

That's weird. Is the app being initialized twice?
Also, why are we printing ourselves the app location, given Flask knows how to do that itself (when running in debug mode, at least)?

Event Timeline

zack raised the priority of this task from to Low.
zack updated the task description. (Show Details)
zack added projects: Developers, Web app.

Strange behavior indeed.

But, it's only true for the dev mode.

Since, uwsgi uses the swh.web.ui.main.run_from_webserver function to start - https://forge.softwareheritage.org/diffusion/SPPROF/browse/master/manifests/swh/deploy/webapp.pp;b621c49653d8ceb2b60180ba1432ed7f42847e15$86-87.

I think that, since it's in debug mode (automatically refresh when a change happens), something might errorneously trick the app to reload itself...

What incur this in my reasoning is that if i force the debug flag to false, it does print only once...

Also, if i let the debug flag but deactivate the reload behavior (use_reloader=False to app.run call)...

Ok, so finally, bad use of logging and print statement.

Fixing it by using appropriately the logging mechanism.

olasd changed the visibility from "All Users" to "Public (No Login Required)".May 13 2016, 5:07 PM