Skip to content

Exception when exiting soon after start #2130

Description

@mentalstring

If exiting mycli as soon as the cursor is ready, it consistently outputs this to the terminal, before returning to the shell:

Exception in thread completion_refresh:

Normally that's the only output. However, after repeating this many times, eventually I got this traceback too.

Traceback Exception in thread completion_refresh: Traceback (most recent call last): File "/usr/local/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/threading.py", line 1082, in _bootstrap_inner self._context.run(self.run) ~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "/usr/local/Cellar/python@3.14/3.14.6/Frameworks/Python.framework/Versions/3.14/lib/python3.14/threading.py", line 1024, in run self._target(*self._args, **self._kwargs) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/mycli/2.12.0/libexec/lib/python3.14/site-packages/mycli/completion_refresher.py", line 99, in _bg_refresh refresher(completer, executor) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/mycli/2.12.0/libexec/lib/python3.14/site-packages/mycli/completion_refresher.py", line 182, in refresh_enum_values completer.extend_enum_values(executor.enum_values()) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/mycli/2.12.0/libexec/lib/python3.14/site-packages/mycli/sqlcompleter.py", line 1070, in extend_enum_values for relname, column, values in enum_data: ^^^^^^^^^ File "/usr/local/Cellar/mycli/2.12.0/libexec/lib/python3.14/site-packages/mycli/sqlexecute.py", line 467, in enum_values cur.execute(self.enum_values_query, (target,)) ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/mycli/2.12.0/libexec/lib/python3.14/site-packages/pymysql/cursors.py", line 157, in execute result = self._query(query) Fatal Python error: _enter_buffered_busy: could not acquire lock for <_io.BufferedWriter name=''> at interpreter shutdown, possibly due to daemon threads Python runtime state: finalizing (tstate=0x0000000102bff1a0)

Current thread 0x00007ff85349ac40 (most recent call first):

Extension modules: _cffi_backend, sqlglot.helper, sqlglot.errors, sqlglot.tokenizer_core, sqlglot.expressions.core, sqlglot.expressions.datatypes, sqlglot.expressions.constraints, sqlglot.expressions.properties, sqlglot.expressions.query, sqlglot.expressions.ddl, sqlglot.expressions.dml, sqlglot.expressions.math, sqlglot.expressions.string, sqlglot.expressions.temporal, sqlglot.expressions.aggregate, sqlglot.expressions.array, sqlglot.expressions.json, sqlglot.expressions.functions, sqlglot.expressions.builders, sqlglot.trie, sqlglot.time, sqlglot.generator, sqlglot.parser, sqlglot.parsers.base, sqlglot.schema, markupsafe._speedups, yaml._yaml (total: 27)
Abort trap: 6 mycli db1

This seems to happen only when the footer says "Refreshing completions". Once it reaches "Prefetching schemas", exiting behaves normally.

Not sure how it is related, but I can only reproduce this when connecting to a remote server using a ssh jump host. If connecting to a local server, it does not happen — possibly because that initialization process is faster.

  • mycli version: 2.12.0 (homebrew)
  • OS/version: macOS 26.6.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions