When I run a KQL query from Jupyter Lab that takes longer than a couple of minutes, I started getting the following error. This was not an issue and I could run long queries without any problems until last week. The details of the bug report can be found below.
ChunkedEncodingError: ("Connection broken: ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)", ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
{
"Kqlmagic_last_execution": {
"args": {
"cell": "-params_dict site_dict\nlet signal1 = 'site_instant_power';\nlet signal2 = 'battery_instant_power';\nlet signal3 = 'battery_instant_reactive_power';\nlet site = site_name;\nlet Signal1 = RawTelemetry_dd | where assetId == site and signal_name == signal1\n | project timestamp , signal1_value = value;\nlet Signal2 = RawTelemetry_dd | where assetId == site and signal_name == signal2\n | project timestamp, signal2_value = value;\nlet Signal3 = RawTelemetry_dd | where assetId == site and signal_name == signal3\n | project timestamp, signal3_value = value;\nSignal1 | join kind= inner (Signal2) on timestamp | join kind = inner (Signal3) on timestamp\n| where signal1_value > 0\n| extend battery_va = sqrt(pow(signal2_value,2) + pow(signal3_value,2))\n| sort by battery_va desc\n| project timestamp, battery_va, signal1_value, signal2_value, signal3_value\n| take 10000;\n",
"line": "",
"override_connection": null,
"override_options": null,
"override_query_properties": null,
"override_result_set": null,
"override_vars": null
},
"connection": "canvasvppdb@canvascluster_australiaeast",
"error": "('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))",
"log": [
"Kqlmagic_core::execute - input: \n\rline: \n\rcell:\n\r-params_dict site_dict\nlet signal1 = 'site_instant_power';\nlet signal2 = 'battery_instant_power';\nlet signal3 = 'battery_instant_reactive_power';\nlet site = site_name;\nlet Signal1 = RawTelemetry_dd | where assetId == site and signal_name == signal1\n | project timestamp , signal1_value = value;\nlet Signal2 = RawTelemetry_dd | where assetId == site and signal_name == signal2\n | project timestamp, signal2_value = value;\nlet Signal3 = RawTelemetry_dd | where assetId == site and signal_name == signal3\n | project timestamp, signal3_value = value;\nSignal1 | join kind= inner (Signal2) on timestamp | join kind = inner (Signal3) on timestamp\n| where signal1_value > 0\n| extend battery_va = sqrt(pow(signal2_value,2) + pow(signal3_value,2))\n| sort by battery_va desc\n| project timestamp, battery_va, signal1_value, signal2_value, signal3_value\n| take 10000;\n",
"Kqlmagic_core::execute - parsed_queries: [{'connection_string': '', 'query': \"let signal1 = 'site_instant_power';\\nlet signal2 = 'battery_instant_power';\\nlet signal3 = 'battery_instant_reactive_power';\\nlet site = site_name;\\nlet Signal1 = RawTelemetry_dd | where assetId == site and signal_name == signal1\\n | project timestamp , signal1_value = value;\\nlet Signal2 = RawTelemetry_dd | where assetId == site and signal_name == signal2\\n | project timestamp, signal2_value = value;\\nlet Signal3 = RawTelemetry_dd | where assetId == site and signal_name == signal3\\n | project timestamp, signal3_value = value;\\nSignal1 | join kind= inner (Signal2) on timestamp | join kind = inner (Signal3) on timestamp\\n| where signal1_value > 0\\n| extend battery_va = sqrt(pow(signal2_value,2) + pow(signal3_value,2))\\n| sort by battery_va desc\\n| project timestamp, battery_va, signal1_value, signal2_value, signal3_value\\n| take 10000;\", 'options': {'auto_dataframe': False, 'short_errors': True, 'feedback': True, 'show_conn_info': 'current', 'columns_to_local_vars': False, 'show_query_time': True, 'show_query': False, 'show_query_link': False, 'query_link_destination': 'Kusto.WebExplorer', 'enable_suppress_result': True, 'plotly_fs_includejs': False, 'popup_window': False, 'auto_limit': 0, 'display_limit': None, 'timeout': None, 'prettytable_style': 'DEFAULT', 'last_raw_result_var': '_kql_raw_result_', 'table_package': 'prettytable', 'plot_package': 'plotly', 'dsn_filename': 'odbc.ini', 'validate_connection_string': True, 'auto_popup_schema': True, 'json_display': 'formatted', 'schema_json_display': 'auto', 'palette_desaturation': 1.0, 'params_dict': {'site_name': 'TeslaGridLogicb11bcafc-5ebd-4370-bc80-b1c9cfacb83a'}, 'palette_name': 'tab10', 'cache': None, 'use_cache': None, 'temp_folder_name': 'temp_files', 'cache_folder_name': 'cache_files', 'export_folder_name': 'exported_files', 'add_kql_ref_to_help': True, 'add_schema_to_help': True, 'notebook_app': 'jupyternotebook', 'debug': False, 'check_magic_version': True, 'show_what_new': True, 'show_init_banner': True, 'warn_missing_dependencies': True, 'warn_missing_env_variables': True, 'allow_single_line_cell': True, 'kqlmagic_kernel': False, 'extras_require': 'default', 'test_notebook_app': 'none', 'cloud': 'public', 'enable_sso': False, 'sso_db_gc_interval': 168, 'try_azcli_login': False, 'try_vscode_login': False, 'try_azcli_login_subscription': None, 'try_token': None, 'try_msi': None, 'request_id_tag': None, 'request_app_tag': None, 'request_user_tag': None, 'request_cache_max_age': 0, 'device_code_login_notification': 'auto', 'device_code_notification_email': '', 'save_as': None, 'save_to': None, 'query_properties': {}, 'palette_colors': 10, 'palette_reverse': False, 'popup_schema': False, 'display_id': False, 'display_handlers': {'acquire_token': None}, 'popup_interaction': 'auto', 'temp_files_server': 'auto', 'temp_files_server_address': None, 'kernel_location': 'auto', 'kernel_id': 'e51ec051-cbaa-4dbe-ae31-9502e0d9833e', 'notebook_service_address': None, 'dynamic_to_dataframe': 'object', 'temp_folder_location': 'starting_dir', 'plotly_layout': None, 'auth_token_warnings': False, 'enable_curly_brackets_params': False, 'nop': False, 'assign_var': None, 'cursor_var': None, 'is_magic': True}, 'command': {}, 'last_query': True}]",
"Account(s) exists in cache, probably with token too. Let's try.",
"Account(s) exists in cache, probably with token too. Let's try.",
"KustoClient::execute - POST request - url: https://canvascluster.australiaeast.kusto.windows.net/v2/rest/query, headers: {'Accept': 'application/json', 'Accept-Encoding': 'gzip,deflate', 'Content-Type': 'application/json; charset=utf-8', 'x-ms-client-version': 'Kqlmagic.Python.Client:0.1.114.dev25', 'x-ms-client-request-id': 'Kqlmagic.execute;8820effb-7a9a-4fdc-86d1-68c350c34716/05f373ad-0e2f-4cb3-af8e-a74f7456ecaf/AzureDataExplorer', 'x-ms-app': 'Kqlmagic;jupyternotebook', 'Authorization': '...', 'Fed': 'True', 'Cache-Control': 'no-cache'}, payload: {'db': 'canvasvppdb', 'csl': \"let site_name = 'TeslaGridLogicb11bcafc-5ebd-4370-bc80-b1c9cfacb83a';let signal1 = 'site_instant_power';\\nlet signal2 = 'battery_instant_power';\\nlet signal3 = 'battery_instant_reactive_power';\\nlet site = site_name;\\nlet Signal1 = RawTelemetry_dd | where assetId == site and signal_name == signal1\\n | project timestamp , signal1_value = value;\\nlet Signal2 = RawTelemetry_dd | where assetId == site and signal_name == signal2\\n | project timestamp, signal2_value = value;\\nlet Signal3 = RawTelemetry_dd | where assetId == site and signal_name == signal3\\n | project timestamp, signal3_value = value;\\nSignal1 | join kind= inner (Signal2) on timestamp | join kind = inner (Signal3) on timestamp\\n| where signal1_value > 0\\n| extend battery_va = sqrt(pow(signal2_value,2) + pow(signal3_value,2))\\n| sort by battery_va desc\\n| project timestamp, battery_va, signal1_value, signal2_value, signal3_value\\n| take 10000;\"}, timeout: None",
"Kqlmagic_core::execute - failed - command: None param: None"
],
"query": {
"request": {
"endpoint": "https://canvascluster.australiaeast.kusto.windows.net/v2/rest/query",
"headers": {
"Accept": "application/json",
"Accept-Encoding": "gzip,deflate",
"Authorization": "...",
"Cache-Control": "no-cache",
"Content-Type": "application/json; charset=utf-8",
"Fed": "True",
"x-ms-app": "Kqlmagic;jupyternotebook",
"x-ms-client-request-id": "Kqlmagic.execute;8820effb-7a9a-4fdc-86d1-68c350c34716/05f373ad-0e2f-4cb3-af8e-a74f7456ecaf/AzureDataExplorer",
"x-ms-client-version": "Kqlmagic.Python.Client:0.1.114.dev25"
},
"payload": {
"csl": "let site_name = 'TeslaGridLogicb11bcafc-5ebd-4370-bc80-b1c9cfacb83a';let signal1 = 'site_instant_power';\nlet signal2 = 'battery_instant_power';\nlet signal3 = 'battery_instant_reactive_power';\nlet site = site_name;\nlet Signal1 = RawTelemetry_dd | where assetId == site and signal_name == signal1\n | project timestamp , signal1_value = value;\nlet Signal2 = RawTelemetry_dd | where assetId == site and signal_name == signal2\n | project timestamp, signal2_value = value;\nlet Signal3 = RawTelemetry_dd | where assetId == site and signal_name == signal3\n | project timestamp, signal3_value = value;\nSignal1 | join kind= inner (Signal2) on timestamp | join kind = inner (Signal3) on timestamp\n| where signal1_value > 0\n| extend battery_va = sqrt(pow(signal2_value,2) + pow(signal3_value,2))\n| sort by battery_va desc\n| project timestamp, battery_va, signal1_value, signal2_value, signal3_value\n| take 10000;",
"db": "canvasvppdb"
},
"timeout": null
}
},
"traceback": [
"Traceback (most recent call last):",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\", line 677, in urlopen",
" chunked=chunked,",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\", line 426, in _make_request",
" six.raise_from(e, None)",
" File \"<string>\", line 3, in raise_from",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\", line 421, in _make_request",
" httplib_response = conn.getresponse()",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\http\\client.py\", line 1321, in getresponse",
" response.begin()",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\http\\client.py\", line 296, in begin",
" version, status, reason = self._read_status()",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\http\\client.py\", line 257, in _read_status",
" line = str(self.fp.readline(_MAXLINE + 1), \"iso-8859-1\")",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\socket.py\", line 589, in readinto",
" return self._sock.recv_into(b)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\ssl.py\", line 1052, in recv_into",
" return self.read(nbytes, buffer)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\ssl.py\", line 911, in read",
" return self._sslobj.read(len, buffer)",
"ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host",
"",
"During handling of the above exception, another exception occurred:",
"",
"Traceback (most recent call last):",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\requests\\adapters.py\", line 449, in send",
" timeout=timeout",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\", line 727, in urlopen",
" method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\util\\retry.py\", line 410, in increment",
" raise six.reraise(type(error), error, _stacktrace)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\packages\\six.py\", line 734, in reraise",
" raise value.with_traceback(tb)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\", line 677, in urlopen",
" chunked=chunked,",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\", line 426, in _make_request",
" six.raise_from(e, None)",
" File \"<string>\", line 3, in raise_from",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py\", line 421, in _make_request",
" httplib_response = conn.getresponse()",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\http\\client.py\", line 1321, in getresponse",
" response.begin()",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\http\\client.py\", line 296, in begin",
" version, status, reason = self._read_status()",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\http\\client.py\", line 257, in _read_status",
" line = str(self.fp.readline(_MAXLINE + 1), \"iso-8859-1\")",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\socket.py\", line 589, in readinto",
" return self._sock.recv_into(b)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\ssl.py\", line 1052, in recv_into",
" return self.read(nbytes, buffer)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\ssl.py\", line 911, in read",
" return self._sslobj.read(len, buffer)",
"urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))",
"",
"During handling of the above exception, another exception occurred:",
"",
"Traceback (most recent call last):",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\Kqlmagic\\kql_magic_core.py\", line 1337, in _execute_query",
" raise e",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\Kqlmagic\\kql_magic_core.py\", line 1327, in _execute_query",
" raw_query_result = engine.execute(parametrized_query, user_ns, **options)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\Kqlmagic\\kql_engine.py\", line 221, in execute",
" response = self.client_execute(query, user_namespace, database, **options)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\Kqlmagic\\kql_engine.py\", line 216, in client_execute",
" return client.execute(database or self.get_client_database_name(), query, accept_partial_results=False, **options)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\Kqlmagic\\kusto_client.py\", line 284, in execute",
" response = requests.post(endpoint, headers=request_headers, json=request_payload, timeout=options.get(\"timeout\"))",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\requests\\api.py\", line 119, in post",
" return request('post', url, data=data, json=json, **kwargs)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\requests\\api.py\", line 61, in request",
" return session.request(method=method, url=url, **kwargs)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\requests\\sessions.py\", line 542, in request",
" resp = self.send(prep, **send_kwargs)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\requests\\sessions.py\", line 655, in send",
" r = adapter.send(request, **kwargs)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\requests\\adapters.py\", line 498, in send",
" raise ConnectionError(err, request=request)",
"requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))",
"",
"During handling of the above exception, another exception occurred:",
"",
"Traceback (most recent call last):",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\Kqlmagic\\kql_magic_core.py\", line 828, in execute",
" result = self._execute_query(parsed, user_ns, result_set=override_result_set, override_vars=override_vars)",
" File \"C:\\Users\\baran\\Anaconda3\\lib\\site-packages\\Kqlmagic\\kql_magic_core.py\", line 1464, in _execute_query",
" raise ShortError(e, messages)",
"Kqlmagic.kql_magic_core.ShortError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))"
]
},
"kqlmagic": {
"version": "0.1.114.dev25"
},
"kqlmagic_connections:": {
"canvasvppdb@canvascluster_australiaeast": {
"auth": {
"aad_login_url": "https://login.microsoftonline.com",
"authentication_method": "aad_device_login",
"authority_uri": "https://login.microsoftonline.com/3ff6cfa4-e715-48db-b8e1-0867b9f9fba3",
"client_app_type": "public",
"client_id": "db662dc1-0cfe-4e1c-a843-19a68e65be58",
"scopes": [
"['https://canvascluster.australiaeast.kusto.windows.net']/.default"
],
"username": "z3476746@ad.unsw.edu.au"
},
"cluster_name": "canvascluster.australiaeast",
"database_name": "canvasvppdb",
"parsed_conn": {
"cluster": "canvascluster.australiaeast",
"code": "",
"database": "canvasvppdb"
}
}
},
"kqlmagic_default_env": {},
"kqlmagic_default_options": {
"add_kql_ref_to_help": true,
"add_schema_to_help": true,
"allow_single_line_cell": true,
"assign_var": null,
"auth_token_warnings": false,
"auto_dataframe": false,
"auto_limit": 0,
"auto_popup_schema": true,
"cache": null,
"cache_folder_name": "cache_files",
"check_magic_version": true,
"cloud": "public",
"columns_to_local_vars": false,
"cursor_var": null,
"debug": false,
"device_code_login_notification": "auto",
"device_code_notification_email": "",
"display_limit": null,
"dsn_filename": "odbc.ini",
"dynamic_to_dataframe": "object",
"enable_curly_brackets_params": false,
"enable_sso": false,
"enable_suppress_result": true,
"export_folder_name": "exported_files",
"extras_require": "default",
"feedback": true,
"is_magic": true,
"json_display": "formatted",
"kernel_id": "e51ec051-cbaa-4dbe-ae31-9502e0d9833e",
"kernel_location": "auto",
"kqlmagic_kernel": false,
"last_raw_result_var": "_kql_raw_result_",
"notebook_app": "jupyternotebook",
"notebook_service_address": null,
"palette_colors": 10,
"palette_desaturation": 1.0,
"palette_name": "tab10",
"plot_package": "plotly",
"plotly_config": null,
"plotly_fs_includejs": false,
"plotly_layout": null,
"popup_interaction": "auto",
"prettytable_style": "DEFAULT",
"query_link_destination": "Kusto.WebExplorer",
"request_app_tag": null,
"request_cache_max_age": 0,
"request_id_tag": null,
"request_user_tag": null,
"schema_json_display": "auto",
"short_errors": true,
"show_conn_info": "current",
"show_init_banner": true,
"show_query": false,
"show_query_link": false,
"show_query_time": true,
"show_what_new": true,
"sso_db_gc_interval": 168,
"table_package": "prettytable",
"temp_files_server": "auto",
"temp_files_server_address": null,
"temp_folder_location": "starting_dir",
"temp_folder_name": "temp_files",
"test_notebook_app": "none",
"timeout": null,
"try_azcli_login": false,
"try_azcli_login_subscription": null,
"try_kqlmaic_sso": false,
"try_msi": null,
"try_token": null,
"try_vscode_login": false,
"use_cache": null,
"validate_connection_string": true,
"warn_missing_dependencies": true,
"warn_missing_env_variables": true
},
"packages": {
"azure-common": "1.1.26",
"azure-identity": "1.5.0",
"beautifulsoup4": "4.9.3",
"cryptography": "3.2.1",
"flask": "1.1.2",
"ipykernel": "5.3.4",
"ipython": "7.19.0",
"ipywidgets": "7.5.1",
"isodate": "0.6.0",
"lxml": "4.6.2",
"markdown": "3.3.3",
"matplotlib": "3.3.2",
"msal": "1.10.0",
"msal_extensions": "0.3.0",
"msrestazure": "0.6.4",
"pandas": "1.1.3",
"password_strength": "0.0.3.post2",
"plotly": "4.14.3",
"prettytable": "2.0.0",
"psutil": "5.7.2",
"pygments": "2.7.2",
"pyperclip": "1.8.1",
"python-dateutil": "2.8.1",
"requests": "2.25.0",
"setuptools": "50.3.2.post20201201",
"traitlets": "5.0.5"
},
"platform": {
"release": "10",
"system": "Windows"
},
"python": {
"name": "CPython",
"version": "3.7.1"
}
}
When I run a KQL query from Jupyter Lab that takes longer than a couple of minutes, I started getting the following error. This was not an issue and I could run long queries without any problems until last week. The details of the bug report can be found below.
ChunkedEncodingError: ("Connection broken: ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)", ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))