From 51ffd44368efa5ddbb0bfa174f1681e60e60eb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Rzepecki?= Date: Wed, 22 Jun 2022 18:28:37 +0200 Subject: [PATCH 1/2] fix: Avoid querying database version when executing client queries While I couldn't reproduce it, a user has reported seeing a stack overflow while processing an SQL query with MySQL and django. It seems to have been caused by appmap querying for the server version, which entails another SQL query against the server with MySQL. Since MySQL backend caches that information, querying it when first establishing the connection ensures the additional query is avoided later at runtime, thus avoiding this problem. Fixes #158 --- appmap/django.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appmap/django.py b/appmap/django.py index da885f44..281faaa0 100644 --- a/appmap/django.py +++ b/appmap/django.py @@ -117,6 +117,11 @@ def wrapped_execute(self, sql, params=None): @receiver(connection_created) def connected(sender, connection, **_): # pylint: disable=unused-argument + + # warm the version cache in the backend to avoid running + # additional queries in the middle of processing client queries + database_version(connection) + wrappers = connection.execute_wrappers if not any(isinstance(x, ExecuteWrapper) for x in wrappers): wrappers.append(ExecuteWrapper()) From 5d72861f71f9d03c801d87add3df25e1245e8bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Rzepecki?= Date: Thu, 23 Jun 2022 11:29:16 +0200 Subject: [PATCH 2/2] Use flask 1 in smoke test --- ci/smoketest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/smoketest.sh b/ci/smoketest.sh index 15135002..54df8080 100755 --- a/ci/smoketest.sh +++ b/ci/smoketest.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -pip install -U pip pytest flask python-decouple +pip install -U pip pytest "flask<2" python-decouple pip install /dist/appmap-*-py3-none-any.whl cp -R /appmap/test/data/unittest/simple ./.