Skip to content

Commit 9b1acaa

Browse files
authoredNov 4, 2023
loose restrict of greenlet (#3) (#326)
1 parent 1a36022 commit 9b1acaa

File tree

6 files changed

+140
-124
lines changed

6 files changed

+140
-124
lines changed
 

‎poetry.lock

+127-108
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ grpcio = '*'
7272
grpcio-tools = '*'
7373
packaging = '*'
7474
wrapt = '*'
75-
psutil = '*'
75+
psutil = '<=5.9.5'
7676
requests = { version = ">=2.26.0", optional = true }
7777
kafka-python = { version = "*", optional = true }
7878
uvloop = { version = "^0.17.0", optional = true }
@@ -129,7 +129,7 @@ celery = "5.1.2"
129129
django = "3.2.8"
130130
elasticsearch = "7.15.1"
131131
flask = "2.0.2"
132-
gevent = "22.8.0"
132+
gevent = "22.10.2"
133133
hug = "2.6.1"
134134
pika = "1.2.0"
135135
psycopg = {extras = ["binary"], version = "^3.1.7"}

‎skywalking/profile/profile_context.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import time
2020
import traceback
2121

22-
from packaging import version
2322
from threading import Thread, Event, current_thread
2423
from typing import Optional
2524

@@ -43,15 +42,12 @@
4342
from gevent.exceptions import BlockingSwitchOutError
4443

4544
if monkey.is_module_patched('threading'):
46-
if version.parse(greenlet.__version__) <= version.parse('1.1.3.post0'):
47-
# todo: greenlet will raise a segment fault with signal 11 when it upgrade to 2.0.0
48-
# this issue may be caused by gevent's compatibility with greenlet
49-
# we should do some tests when gevent release a new version to verify if this issue would be fixed
50-
THREAD_MODEL = 'greenlet'
51-
else:
52-
logger.warn('greenlet profiler can not work with version >= 2.0.0')
45+
THREAD_MODEL = 'greenlet'
46+
logger.debug('Using greenlet model')
47+
else:
48+
logger.debug('Gevent monkey exists but does not patch threading, using threading model')
5349
except ImportError:
54-
pass
50+
logger.debug("Gevent does\'t exist, using threading model")
5551

5652

5753
class ProfileTaskExecutionContext:
@@ -326,6 +322,7 @@ def build_snapshot(self) -> Optional[TracingThreadSnapshot]:
326322

327323

328324
def start_profiling(self, context: ProfileTaskExecutionContext):
325+
logger.debug('GreenletProfiler::start_profiling')
329326
self._task_execution_context = context
330327
try:
331328
curr = self._profiling_thread

‎tests/e2e/base/Dockerfile.e2e

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ RUN cd /skywalking-python && apt-get update && apt-get install -y make && make i
3131
RUN apt-get update \
3232
&& apt-get install -y --no-install-recommends gcc build-essential\
3333
&& rm -rf /var/lib/apt/lists/* \
34-
&& pip install uwsgi fastapi uvicorn aiohttp flask gunicorn\
34+
&& pip install uwsgi fastapi uvicorn aiohttp flask "Werkzeug<3" gunicorn \
3535
&& apt-get purge -y --auto-remove gcc build-essential
3636

3737
# Entrypoint with agent attached

‎tests/e2e/case/profiling/greenlet/start_gevent.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
#
1919

2020
set -ex
21-
pip install gunicorn gevent "greenlet<2.0.0"
22-
gunicorn -k gevent -b :9090 --chdir /services entrypoint:app
21+
pip install gunicorn gevent "greenlet>=3"
22+
gunicorn -k gevent -b :9090 --chdir /services entrypoint:app

‎tests/plugin/web/sw_flask/docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
- 9091:9091
3232
volumes:
3333
- .:/app
34-
command: ['bash', '-c', 'pip install flask itsdangerous==2.0.1 && pip install -r /app/requirements.txt && sw-python run python3 /app/services/provider.py']
34+
command: ['bash', '-c', 'pip install flask itsdangerous==2.0.1 "Werkzeug<3" && pip install -r /app/requirements.txt && sw-python run python3 /app/services/provider.py']
3535
depends_on:
3636
collector:
3737
condition: service_healthy
@@ -52,7 +52,7 @@ services:
5252
- 9090:9090
5353
volumes:
5454
- .:/app
55-
command: ['bash', '-c', 'pip install flask itsdangerous==2.0.1 && pip install -r /app/requirements.txt && sw-python run python3 /app/services/consumer.py']
55+
command: ['bash', '-c', 'pip install flask itsdangerous==2.0.1 "Werkzeug<3" && pip install -r /app/requirements.txt && sw-python run python3 /app/services/consumer.py']
5656
depends_on:
5757
collector:
5858
condition: service_healthy

0 commit comments

Comments
 (0)
Please sign in to comment.