-
Notifications
You must be signed in to change notification settings - Fork 131
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
Debugpy unable to start Flask server #1296
Comments
i am having same issue, in my docker compose: command: python -m debugpy --listen 0.0.0.0:5666 -m flask run --host=0.0.0.0 gets error: RuntimeError: Can't listen for client connections: [Errno 98] Address already in use setting flask to --no-reload lets the app load, but i am losing functionality i am able to get it to work if explicitly set these versions: |
We are also experiencing exactly this problem. Is there any update on when it will be fixed please? |
Same issue here - we start losing the ability to debug if we upgrade any Python3.10 application to Werkzeug 2.3.0. |
Note that you can disable the Flask reloader by using |
Are you following https://code.visualstudio.com/docs/containers/docker-compose for For https://code.visualstudio.com/docs/containers/docker-compose and utilizing sample code https://github.com/j2eeexpert2015/flask_docker, I finish following steps:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
],
"justMyCode": true
}
]
}
version: "2"
services:
app:
build: ./app
++ command: ["sh", "-c", "pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 app.py runserver 0.0.0.0:5000 --nothreading --noreload"]
links:
- db
ports:
- "5000:5000"
++ - 5678:5678
db:
image: mysql:5.7
ports:
- "32000:3306"
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- ./db:/docker-entrypoint-initdb.d/:ro
COPY app.py /app
++RUN pip install debugpy
CMD python app.py
Executing task: docker compose -f "docker-compose.debug.yml" up -d --build
[+] Building 0.6s (11/11) FINISHED docker:default
=> [app internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [app internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 206B 0.0s
=> [app internal] load metadata for docker.io/library/python:3.6 0.4s
=> [app 1/6] FROM docker.io/library/python:3.6@sha256:f8652afaf88c25f0d22354d547d892591067aa4026a7fa9a6819df9f300af6fc 0.0s
=> [app internal] load build context 0.0s
=> => transferring context: 63B 0.0s
=> CACHED [app 2/6] WORKDIR /app 0.0s
=> CACHED [app 3/6] COPY requirements.txt /app 0.0s
=> CACHED [app 4/6] RUN pip install -r requirements.txt 0.0s
=> CACHED [app 5/6] COPY app.py /app 0.0s
=> CACHED [app 6/6] RUN pip install debugpy 0.0s
=> [app] exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:6f77b8fe1a24179a7ee1f8450ecf30f33a8a2d01cb8523fbe1891679882967eb 0.0s
=> => naming to docker.io/library/flask_docker-app 0.0s
[+] Running 3/3
✔ Network flask_docker_default Created 0.1s
✔ Container flask_docker-db-1 Started 0.1s
✔ Container flask_docker-app-1 Started 0.1s
* Terminal will be reused by tasks, press any key to close it. or docker-compose up
Creating network "flask_docker_default" with the default driver
Creating flask_docker_db_1 ... done
Creating flask_docker_app_1 ... done
Attaching to flask_docker_db_1, flask_docker_app_1
db_1 | 2024-01-01 22:32:02+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
db_1 | 2024-01-01 22:32:02+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1 | 2024-01-01 22:32:02+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
db_1 | 2024-01-01 22:32:02+00:00 [Note] [Entrypoint]: Initializing database files
db_1 | 2024-01-01T22:32:02.961535Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1 | 2024-01-01T22:32:03.211579Z 0 [Warning] InnoDB: New log files created, LSN=45790
db_1 | 2024-01-01T22:32:03.271596Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
db_1 | 2024-01-01T22:32:03.342051Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9614249d-a8f5-11ee-afd7-0242ac140002.
db_1 | 2024-01-01T22:32:03.348199Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
db_1 | 2024-01-01T22:32:03.465054Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
db_1 | 2024-01-01T22:32:03.465064Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
db_1 | 2024-01-01T22:32:03.465341Z 0 [Warning] CA certificate ca.pem is self signed.
db_1 | 2024-01-01T22:32:03.471705Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
app_1 | Collecting debugpy
app_1 | Using cached debugpy-1.5.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.9 MB)
app_1 | Installing collected packages: debugpy
app_1 | Successfully installed debugpy-1.5.1
app_1 | WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
app_1 | WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
app_1 | You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
db_1 | 2024-01-01 22:32:07+00:00 [Note] [Entrypoint]: Database files initialized
db_1 | 2024-01-01 22:32:07+00:00 [Note] [Entrypoint]: Starting temporary server
db_1 | 2024-01-01 22:32:08+00:00 [Note] [Entrypoint]: Waiting for server startup
db_1 | 2024-01-01T22:32:08.159998Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1 | 2024-01-01T22:32:08.160922Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 124 ...
db_1 | 2024-01-01T22:32:08.162816Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1 | 2024-01-01T22:32:08.162833Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1 | 2024-01-01T22:32:08.162835Z 0 [Note] InnoDB: Uses event mutexes
db_1 | 2024-01-01T22:32:08.162838Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1 | 2024-01-01T22:32:08.162839Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
db_1 | 2024-01-01T22:32:08.162840Z 0 [Note] InnoDB: Using Linux native AIO
db_1 | 2024-01-01T22:32:08.163000Z 0 [Note] InnoDB: Number of pools: 1
db_1 | 2024-01-01T22:32:08.163069Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1 | 2024-01-01T22:32:08.164143Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1 | 2024-01-01T22:32:08.167973Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1 | 2024-01-01T22:32:08.169052Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1 | 2024-01-01T22:32:08.180233Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1 | 2024-01-01T22:32:08.197763Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1 | 2024-01-01T22:32:08.197808Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1 | 2024-01-01T22:32:08.213086Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1 | 2024-01-01T22:32:08.213443Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1 | 2024-01-01T22:32:08.213447Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1 | 2024-01-01T22:32:08.213703Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 2768291
db_1 | 2024-01-01T22:32:08.213814Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1 | 2024-01-01T22:32:08.213934Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1 | 2024-01-01T22:32:08.214805Z 0 [Note] InnoDB: Buffer pool(s) load completed at 240101 22:32:08
db_1 | 2024-01-01T22:32:08.217155Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
db_1 | 2024-01-01T22:32:08.217161Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
db_1 | 2024-01-01T22:32:08.217163Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
db_1 | 2024-01-01T22:32:08.217164Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
db_1 | 2024-01-01T22:32:08.217463Z 0 [Warning] CA certificate ca.pem is self signed.
db_1 | 2024-01-01T22:32:08.217481Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
db_1 | 2024-01-01T22:32:08.223329Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1 | 2024-01-01T22:32:08.226573Z 0 [Note] Event Scheduler: Loaded 0 events
db_1 | 2024-01-01T22:32:08.226696Z 0 [Note] mysqld: ready for connections.
db_1 | Version: '5.7.44' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL)
db_1 | 2024-01-01 22:32:09+00:00 [Note] [Entrypoint]: Temporary server started.
db_1 | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
db_1 | 2024-01-01T22:32:09.026098Z 3 [Note] InnoDB: Stopping purge
db_1 | 2024-01-01T22:32:09.046927Z 3 [Note] InnoDB: Resuming purge
db_1 | 2024-01-01T22:32:09.052902Z 3 [Note] InnoDB: Stopping purge
db_1 | 2024-01-01T22:32:09.064590Z 3 [Note] InnoDB: Resuming purge
db_1 | 2024-01-01T22:32:09.070887Z 3 [Note] InnoDB: Stopping purge
db_1 | 2024-01-01T22:32:09.082701Z 3 [Note] InnoDB: Resuming purge
db_1 | 2024-01-01T22:32:09.089075Z 3 [Note] InnoDB: Stopping purge
db_1 | 2024-01-01T22:32:09.101439Z 3 [Note] InnoDB: Resuming purge
db_1 | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
db_1 | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
db_1 | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
db_1 | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
db_1 | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
db_1 |
db_1 | 2024-01-01 22:32:10+00:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init.sql
db_1 |
db_1 |
db_1 | 2024-01-01 22:32:10+00:00 [Note] [Entrypoint]: Stopping temporary server
db_1 | 2024-01-01T22:32:10.153423Z 0 [Note] Giving 0 client threads a chance to die gracefully
db_1 | 2024-01-01T22:32:10.153437Z 0 [Note] Shutting down slave threads
db_1 | 2024-01-01T22:32:10.153440Z 0 [Note] Forcefully disconnecting 0 remaining clients
db_1 | 2024-01-01T22:32:10.153443Z 0 [Note] Event Scheduler: Purging the queue. 0 events
db_1 | 2024-01-01T22:32:10.153465Z 0 [Note] Binlog end
db_1 | 2024-01-01T22:32:10.160297Z 0 [Note] Shutting down plugin 'ngram'
db_1 | 2024-01-01T22:32:10.160311Z 0 [Note] Shutting down plugin 'partition'
db_1 | 2024-01-01T22:32:10.160313Z 0 [Note] Shutting down plugin 'BLACKHOLE'
db_1 | 2024-01-01T22:32:10.160315Z 0 [Note] Shutting down plugin 'ARCHIVE'
db_1 | 2024-01-01T22:32:10.160317Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
db_1 | 2024-01-01T22:32:10.160338Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
db_1 | 2024-01-01T22:32:10.160340Z 0 [Note] Shutting down plugin 'MyISAM'
db_1 | 2024-01-01T22:32:10.160351Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
db_1 | 2024-01-01T22:32:10.160353Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
db_1 | 2024-01-01T22:32:10.160355Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
db_1 | 2024-01-01T22:32:10.160356Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
db_1 | 2024-01-01T22:32:10.160357Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
db_1 | 2024-01-01T22:32:10.160358Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
db_1 | 2024-01-01T22:32:10.160360Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
db_1 | 2024-01-01T22:32:10.160361Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
db_1 | 2024-01-01T22:32:10.160361Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
db_1 | 2024-01-01T22:32:10.160362Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
db_1 | 2024-01-01T22:32:10.160364Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
db_1 | 2024-01-01T22:32:10.160364Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
db_1 | 2024-01-01T22:32:10.160365Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
db_1 | 2024-01-01T22:32:10.160366Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
db_1 | 2024-01-01T22:32:10.160367Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
db_1 | 2024-01-01T22:32:10.160368Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
db_1 | 2024-01-01T22:32:10.160369Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
db_1 | 2024-01-01T22:32:10.160370Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
db_1 | 2024-01-01T22:32:10.160371Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
db_1 | 2024-01-01T22:32:10.160372Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
db_1 | 2024-01-01T22:32:10.160373Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
db_1 | 2024-01-01T22:32:10.160374Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
db_1 | 2024-01-01T22:32:10.160376Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
db_1 | 2024-01-01T22:32:10.160377Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
db_1 | 2024-01-01T22:32:10.160378Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
db_1 | 2024-01-01T22:32:10.160379Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
db_1 | 2024-01-01T22:32:10.160380Z 0 [Note] Shutting down plugin 'INNODB_CMP'
db_1 | 2024-01-01T22:32:10.160381Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
db_1 | 2024-01-01T22:32:10.160382Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
db_1 | 2024-01-01T22:32:10.160383Z 0 [Note] Shutting down plugin 'INNODB_TRX'
db_1 | 2024-01-01T22:32:10.160384Z 0 [Note] Shutting down plugin 'InnoDB'
db_1 | 2024-01-01T22:32:10.160442Z 0 [Note] InnoDB: FTS optimize thread exiting.
db_1 | 2024-01-01T22:32:10.160555Z 0 [Note] InnoDB: Starting shutdown...
db_1 | 2024-01-01T22:32:10.260733Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
db_1 | 2024-01-01T22:32:10.260877Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 240101 22:32:10
db_1 | 2024-01-01T22:32:11.290973Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12227086
db_1 | 2024-01-01T22:32:11.292015Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
db_1 | 2024-01-01T22:32:11.292035Z 0 [Note] Shutting down plugin 'MEMORY'
db_1 | 2024-01-01T22:32:11.292038Z 0 [Note] Shutting down plugin 'CSV'
db_1 | 2024-01-01T22:32:11.292040Z 0 [Note] Shutting down plugin 'sha256_password'
db_1 | 2024-01-01T22:32:11.292040Z 0 [Note] Shutting down plugin 'mysql_native_password'
db_1 | 2024-01-01T22:32:11.292114Z 0 [Note] Shutting down plugin 'binlog'
db_1 | 2024-01-01T22:32:11.293093Z 0 [Note] mysqld: Shutdown complete
db_1 |
db_1 | 2024-01-01 22:32:12+00:00 [Note] [Entrypoint]: Temporary server stopped
db_1 |
db_1 | 2024-01-01 22:32:12+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
db_1 |
db_1 | 2024-01-01T22:32:12.320317Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1 | 2024-01-01T22:32:12.324342Z 0 [Note] mysqld (mysqld 5.7.44) starting as process 1 ...
db_1 | 2024-01-01T22:32:12.327188Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1 | 2024-01-01T22:32:12.327210Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1 | 2024-01-01T22:32:12.327214Z 0 [Note] InnoDB: Uses event mutexes
db_1 | 2024-01-01T22:32:12.327216Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1 | 2024-01-01T22:32:12.327220Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
db_1 | 2024-01-01T22:32:12.327221Z 0 [Note] InnoDB: Using Linux native AIO
db_1 | 2024-01-01T22:32:12.327466Z 0 [Note] InnoDB: Number of pools: 1
db_1 | 2024-01-01T22:32:12.327563Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1 | 2024-01-01T22:32:12.328833Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1 | 2024-01-01T22:32:12.343717Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1 | 2024-01-01T22:32:12.345509Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1 | 2024-01-01T22:32:12.365297Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1 | 2024-01-01T22:32:12.384479Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1 | 2024-01-01T22:32:12.384535Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1 | 2024-01-01T22:32:12.403458Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1 | 2024-01-01T22:32:12.404061Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1 | 2024-01-01T22:32:12.404070Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1 | 2024-01-01T22:32:12.404452Z 0 [Note] InnoDB: 5.7.44 started; log sequence number 12227086
db_1 | 2024-01-01T22:32:12.404571Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1 | 2024-01-01T22:32:12.404810Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1 | 2024-01-01T22:32:12.407917Z 0 [Note] InnoDB: Buffer pool(s) load completed at 240101 22:32:12
db_1 | 2024-01-01T22:32:12.409841Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
db_1 | 2024-01-01T22:32:12.409855Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
db_1 | 2024-01-01T22:32:12.409858Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
db_1 | 2024-01-01T22:32:12.409859Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
db_1 | 2024-01-01T22:32:12.410374Z 0 [Warning] CA certificate ca.pem is self signed.
db_1 | 2024-01-01T22:32:12.410410Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
db_1 | 2024-01-01T22:32:12.410708Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
db_1 | 2024-01-01T22:32:12.410743Z 0 [Note] IPv6 is available.
db_1 | 2024-01-01T22:32:12.410754Z 0 [Note] - '::' resolves to '::';
db_1 | 2024-01-01T22:32:12.410772Z 0 [Note] Server socket created on IP: '::'.
db_1 | 2024-01-01T22:32:12.416621Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1 | 2024-01-01T22:32:12.421924Z 0 [Note] Event Scheduler: Loaded 0 events
db_1 | 2024-01-01T22:32:12.422097Z 0 [Note] mysqld: ready for connections.
db_1 | Version: '5.7.44' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
While {"get_employees": [{"Employee1": "Developer"}, {"Employee2": "HR"}]}` the breakpoint turns from red to hollow circle and never get hit |
Submit issue #1491 |
Did anybody ever find a workaround for this? |
Any other workaround for this? Other than bumping down werkzeug and flask versions? |
I've got a workaround, but you have to use debugpy API instead of the CLI. Just find the place in your code before you call
This will start debugpy only for the first original invocation of your app and not for the subsequent reload invocations. The |
still encountering this; I need to keep live reloading enabled in a dev image with debugpy installed, and for now I'm stuck on Flask 2.2 until this gets fixed. |
Same here. Very annoying. No new workaround from someone? |
Same problem. Just upgrading from Werkzeug 2.2.2 to 2.3.8 debugpy doesen't work anymore. |
Same here. I have a project waiting for this update :( |
I've tried to provide a fix in #1657 since I need this functionality for a dockerised Flask project. So far it seems to work just fine. The tests are also positive with the exception of |
This seems to work for me with the latest bits of debugpy and werkzeug. I do get an exception when reloading, but debugpy does attach to the new instance:
I have werkzeug 3.0.4 and debugpy 1.8.5 |
On Debian, I get this fatal error:
Same version of werkzeug and debugpy. |
Okay must be a linux only issue. I'll try on WSL (don't have a linux machine handy). |
Hmm, works fine on WSL too. I don't even get the error I had on windows. |
I tried the fix in #1657 and although I can't seem to reproduce the original error, the fix doesn't seem to break anything, so I merged it. Hopefully this fixes the problem for everybody. |
There's a lot of platform-specific weirdness around sockets, so it's not surprising that behavior differs. Note though that even when it works, it means that you have two different debugpy adapter processes, one of which is trying to manage both the parent and the child, while the other one (the one that causes the error on Linux and quietly overwrites the socket on Windows) is only managing the child. I'm not quite sure what the overall effects of that would be, but it's likely to break eventually. |
I can confirm that the #1657 fix has resolved the issue I was facing on multiple applications running Python 3.11. I've pulled the commit into my requirements file and upgraded Flask to 3.0.3 and Werkzeug to 3.0.4. The debugger now starts without any issue and I'm able to use hot-reloading. Thanks @oelhammouchi and @rchiodo |
Environment data
Actual behaviour
When using a startup command to run a Flask server with debugpy and code reloading like this:
FLASK_DEBUG=true FLASK_ENV=development python3 -m debugpy --listen 0.0.0.0:5678 -m flask run
debugpy raises a RuntimeException:
Details
I looked a bit more into the problem and it seems that a change in Werkzeug causes this.
sys.orig_argv
passes the entire command to the reloader i.e.python3 -m debugpy --listen 0.0.0.0:5678 -m flask run
- which leads to a second instance of debugpy being started without shutting down the previous one causing the traceback from debugpy side. I already raised an issue on the Werkzeug side and they signalled that it should be handled on the debugpy side.Expected behaviour
No RuntimeError emitted and Debugpy can start a Flask server with code reloading.
Steps to reproduce:
The text was updated successfully, but these errors were encountered: