Skip to content
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

Mapproxy restart multiple times at startup #915

Open
alfmarcua opened this issue Apr 1, 2024 · 2 comments
Open

Mapproxy restart multiple times at startup #915

alfmarcua opened this issue Apr 1, 2024 · 2 comments
Labels

Comments

@alfmarcua
Copy link
Contributor

Context

When executing the mapproxy-util serve-develop {conf-file}.yaml command, the service is restarted one or more times, so the configuration file is read at least twice. Therefore the service startup time is increased.

Expected Behavior

The mapproxy service should be started only once.

Actual Behavior

When the service starts, the following message appears: mapproxy.config - INFO - reading: path/to/conf-file.yaml
When it finishes it shows that the service is running on localhost:8080 but when it starts the message "Restarting with reloader" appears, and again reads the configuration file:

[2024-04-01 12:11:56,650] mapproxy.config - INFO - reading: /path/to/conf.yaml
[info]  * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
[info]  * Restarting with reloader
[2024-04-01 12:12:21,102] mapproxy.config - INFO - reading: /path/to/conf.yaml

Possible Fix

Steps to Reproduce

  1. Create a configuration file containing several layers
  2. Execute the command "mapproxy-util serve-develop {conf-file}.yaml"
  3. Observe the log and check how many times the file is read

Context

The objective is that the service is not restarted, in order to reduce the time required for the service to be started up.

Your Environment

  • Version used: MapProxy 1.16
  • Environment name and version: Python 3.10
  • Server type and version:
  • Operating System and version: Ubuntu
@simonseyock
Copy link
Contributor

You are right, this should not happen normally. I will look if there is an easy fix for this. But as this script is only to be used for development, this is an inconvenience that we might have to live with.

@simonseyock simonseyock added the bug label Jun 5, 2024
@simonseyock
Copy link
Contributor

The first reading in of the configuration happens when creating the app here:

https://github.com/mapproxy/mapproxy/blob/master/mapproxy/script/util.py#L85

Then it is later restarted with reloading here:

https://github.com/mapproxy/mapproxy/blob/master/mapproxy/util/ext/serving.py#L406

To change this we would have to change all the calls in the chain to not pass along an app, but only the configuration. This might cause problems with other calls of these functions. I think it might be quite the hassle to change this.

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

No branches or pull requests

2 participants