Skip to content

Fix crash caused by DuckDB connection error #745

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

Closed
tconbeer opened this issue Feb 6, 2025 · 1 comment · Fixed by #747
Closed

Fix crash caused by DuckDB connection error #745

tconbeer opened this issue Feb 6, 2025 · 1 comment · Fixed by #747
Labels
bug Something isn't working

Comments

@tconbeer
Copy link
Owner

tconbeer commented Feb 6, 2025

When opening the same db in two terminals:

~/open/harlequin fix/infinity-timestamps ≢  ~3  3.9 ❯ make serve
textual run --dev -c harlequin -P dev -f . f1.db
╭─ DuckDB couldn't connect to your database. ──────────────────────────────────────────────────────────────────────────╮
│ IO Error: Could not set lock on file "/home/tco/open/harlequin/f1.db": Conflicting lock is held in                   │
│ /home/tco/.local/share/uv/python/cpython-3.9.20-linux-x86_64-gnu/bin/python3.9 (PID 26697). See also                 │
│ https://duckdb.org/docs/connect/concurrency                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ /home/tco/open/harlequin/src/harlequin/components/code_editor.py:224 in on_mount                                     │
│                                                                                                                      │
│   221 │   async def on_mount(self) -> None:                                                                          │
│   222 │   │   if self.startup_cache is not None:                                                                     │
│   223 │   │   │   for _i, buffer in enumerate(self.startup_cache.buffers):                                           │
│ ❱ 224 │   │   │   │   await self.action_new_buffer(state=buffer)                                                     │
│   225 │   │   │   │   # we can't load the focus state here, since Tabs                                               │
│   226 │   │   │   │   # really wants to activate the first tab when it's                                             │
│   227 │   │   │   │   # mounted                                                                                      │
│                                                                                                                      │
│ ╭───────────────────────────────────────────────── locals ─────────────────────────────────────────────────╮         │
│ │     _i = 0                                                                                               │         │
│ │ buffer = BufferState(                                                                                    │         │
│ │          │   selection=Selection(start=(3, 39), end=(3, 39)),                                            │         │
│ │          │   text="-- select current_date, current_timestamp::timestamp, '2025-02-05 22:07:42.90456"+175 │         │
│ │          )                                                                                               │         │
│ │   self = EditorCollection()                                                                              │         │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯         │
│                                                                                                                      │
│ /home/tco/open/harlequin/src/harlequin/components/code_editor.py:275 in action_new_buffer                            │
│                                                                                                                      │
│   272 │   │   │   editor,                                                                                            │
│   273 │   │   │   id=new_tab_id,                                                                                     │
│   274 │   │   )                                                                                                      │
│ ❱ 275 │   │   await self.add_pane(pane)                                                                              │
│   276 │   │   if state is not None:                                                                                  │
│   277 │   │   │   editor.selection = state.selection                                                                 │
│   278 │   │   else:                                                                                                  │
│                                                                                                                      │
│ ╭─────────────────────────────────────────────────── locals ───────────────────────────────────────────────────╮     │
│ │     editor = CodeEditor(id='buffer-1')                                                                       │     │
│ │ new_tab_id = 'tab-1'                                                                                         │     │
│ │       pane = TabPane(id='tab-1')                                                                             │     │
│ │       self = EditorCollection()                                                                              │     │
│ │      state = BufferState(                                                                                    │     │
│ │              │   selection=Selection(start=(3, 39), end=(3, 39)),                                            │     │
│ │              │   text="-- select current_date, current_timestamp::timestamp, '2025-02-05 22:07:42.90456"+175 │     │
│ │              )                                                                                               │     │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯     │
│                                                                                                                      │
│ /home/tco/.cache/pypoetry/virtualenvs/harlequin-4LobG8aN-py3.9/lib/python3.9/site-packages/textual/widgets/_tabbed_c │
│ ontent.py:441 in add_pane                                                                                            │
│                                                                                                                      │
│   438 │   │   assert pane.id is not None                                                                             │
│   439 │   │   pane.display = False                                                                                   │
│   440 │   │   return AwaitComplete(                                                                                  │
│ ❱ 441 │   │   │   tabs.add_tab(                                                                                      │
│   442 │   │   │   │   ContentTab(pane._title, pane.id),                                                              │
│   443 │   │   │   │   before=before if before is None else ContentTab.add_prefix(before),                            │
│   444 │   │   │   │   after=after if after is None else ContentTab.add_prefix(after),                                │
│                                                                                                                      │
│ ╭─────────── locals ───────────╮                                                                                     │
│ │  after = None                │                                                                                     │
│ │ before = None                │                                                                                     │
│ │   pane = TabPane(id='tab-1') │                                                                                     │
│ │   self = EditorCollection()  │                                                                                     │
│ │   tabs = ContentTabs()       │                                                                                     │
│ ╰──────────────────────────────╯                                                                                     │
│                                                                                                                      │
│ /home/tco/.cache/pypoetry/virtualenvs/harlequin-4LobG8aN-py3.9/lib/python3.9/site-packages/textual/widgets/_tabs.py: │
│ 492 in add_tab                                                                                                       │
│                                                                                                                      │
│   489 │   │   │   else self._auto_tab_id(tab)                                                                        │
│   490 │   │   )                                                                                                      │
│   491 │   │                                                                                                          │
│ ❱ 492 │   │   mount_await = self.query_one("#tabs-list").mount(                                                      │
│   493 │   │   │   tab_widget, before=before, after=after                                                             │
│   494 │   │   )                                                                                                      │
│   495                                                                                                                │
│                                                                                                                      │
│ ╭───────────────────── locals ──────────────────────╮                                                                │
│ │      after = None                                 │                                                                │
│ │     before = None                                 │                                                                │
│ │ from_empty = True                                 │                                                                │
│ │       self = ContentTabs()                        │                                                                │
│ │        tab = ContentTab(id='--content-tab-tab-1') │                                                                │
│ │ tab_widget = ContentTab(id='--content-tab-tab-1') │                                                                │
│ ╰───────────────────────────────────────────────────╯                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
NoMatches: No nodes match '#tabs-list' on ContentTabs()

NOTE: 2 errors shown above.
@tconbeer tconbeer added the bug Something isn't working label Feb 6, 2025
@tconbeer
Copy link
Owner Author

tconbeer commented Feb 6, 2025

Related to: Textualize/textual#5325

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant