Skip to content

[Bug] No option to stop, pause or cancel embedding of linked folder once it has begun and the process is now stuck indefinitely  #13095

Closed

Description

@dv0ps

Where are you using Unsloth?

Unsloth desktop application
Operating system and version:

Edition: Windows 11 Pro
Version: 26H2
OS build: 26300.9550
Experience: Windows Feature Experience Pack 1000.26100.372.0
GPU model(s) and accelerator backend:

Processor: 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz (2.50 GHz)
Installed RAM: 64.0 GB (63.7 GB usable)
Graphics cards:
NVIDIA GeForce RTX 3090 (24 GB)
NVIDIA RTX A3000 Laptop GPU (6 GB)
Intel(R) UHD Graphics (128 MB)
Versions:

Unsloth Version: v0.1.905-beta
Package Version: 2026.10.3
Desktop App Version: 0.1.905-beta
llama.cpp Version: b11443-mix-d65395f

What happened?
Steps to reproduce:
1-Changed Documents & RAG Embedding Model to unsloth/embeddinggemma-2
2-Created a Projects folder and chose to Link Folder with 189 PDF files sized from 35KB to 82,882 KB
3-Monitored GPU to see that embedding model was loaded onto RTX3090 and it was doing the work
4-Tried to stop the process as the embedding process appeared to be stuck not adding anymore documents after hours of waiting with the GPU running but nothing progressing just the circle spinning to the right of the folder name. The counter even reset and says 0 of 0 files
5-clicked the spinning circle but found no stop or pause option (that needs addressing)
6-Chose "Unlink and keep indexed files" which causes temporarily the status to say "No linked folder" however, it is soon replaced by the folder name and 0 of 0 files.

Expected behavior:
An option to cancel, stop or pause the embedding process

Actual behavior:
Nothing provides the option to stop or remove the folder

Model and operation involved:
unsloth/embeddinggemma-2

LOGS

sqlite3.OperationalError: database is locked
{"timestamp": "2026-10-08T20:17:19.316035Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folder-jobs/17fc48ac-70d3-4f37-a004-f2471d9086af", "status_code": 200, "process_time_ms": 5.88}
{"timestamp": "2026-10-08T20:17:19.592320Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/projects/08ee2d4c-2b90-46cd-80e1-fe7cf3ebfb27/documents", "status_code": 200, "process_time_ms": 7.77}
{"timestamp": "2026-10-08T20:17:21.747572Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/inference/monitor", "status_code": 200, "process_time_ms": 3.43}
{"timestamp": "2026-10-08T20:17:22.334550Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folder-jobs/17fc48ac-70d3-4f37-a004-f2471d9086af", "status_code": 200, "process_time_ms": 5.66}
{"timestamp": "2026-10-08T20:17:22.383367Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folders", "status_code": 200, "process_time_ms": 6.4}
{"timestamp": "2026-10-08T20:17:23.598848Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/projects/08ee2d4c-2b90-46cd-80e1-fe7cf3ebfb27/documents", "status_code": 200, "process_time_ms": 7.82}
{"timestamp": "2026-10-08T20:17:25.347466Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folder-jobs/17fc48ac-70d3-4f37-a004-f2471d9086af", "status_code": 200, "process_time_ms": 5.51}
{"timestamp": "2026-10-08T20:17:26.396846Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folders", "status_code": 200, "process_time_ms": 5.65}
{"timestamp": "2026-10-08T20:17:27.604300Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/projects/08ee2d4c-2b90-46cd-80e1-fe7cf3ebfb27/documents", "status_code": 200, "process_time_ms": 11.08}
{"timestamp": "2026-10-08T20:17:28.365313Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folder-jobs/17fc48ac-70d3-4f37-a004-f2471d9086af", "status_code": 200, "process_time_ms": 7.73}
{"timestamp": "2026-10-08T20:17:29.017635Z", "level": "error", "event": "request_failed", "path": "/api/rag/linked-folders/d06239c0-3eb1-4ba3-91b0-d2ed2d3d4df7", "method": "DELETE", "status_code": 500, "error": "database is locked", "process_time_ms": 5473.37, "exception": "Traceback (most recent call last):\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\loggers\handlers.py", line 312, in call\n await self.app(scope, receive, send_wrapper)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in call\n await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app\n raise exc\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app\n await app(scope, receive, sender)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call\n await self.app(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\routing.py", line 670, in call\n await self.middleware_stack(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 2734, in app\n await route.handle(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 1780, in handle\n await self.original_router.handle(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 2789, in handle\n await included_router._handle_selected(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected\n await original_route.handle(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 1279, in handle\n await app(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 158, in app\n await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app\n raise exc\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app\n await app(scope, receive, sender)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 144, in app\n response = await f(request)\n ^^^^^^^^^^^^^^^^\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 706, in app\n raw_response = await run_endpoint_function(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ...<3 lines>...\n )\n ^\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 354, in run_endpoint_function\n return await run_in_threadpool(dependant.call, **values)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\concurrency.py", line 34, in run_in_threadpool\n return await anyio.to_thread.run_sync(func)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\anyio\to_thread.py", line 63, in run_sync\n return await get_async_backend().run_sync_in_worker_thread(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n func, args, abandon_on_cancel=abandon_on_cancel, limiter=limiter\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\anyio\_backends\_asyncio.py", line 2518, in run_sync_in_worker_thread\n return await future\n ^^^^^^^^^^^^\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\anyio\_backends\_asyncio.py", line 1002, in run\n result = context.run(func, *args)\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\routes\rag.py", line 749, in unlink_folder\n if not folder_sync.delete_folder(folder_id, remove_index = remove_index):\n ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "C:\Users\grant\.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\core\rag\folder_sync.py", line 573, in delete_folder\n conn.execute("BEGIN IMMEDIATE")\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^\nsqlite3.OperationalError: database is locked"}
| Traceback (most recent call last):
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\loggers\handlers.py", line 312, in call
| await self.app(scope, receive, send_wrapper)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in call
| await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
| raise exc
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app
| await app(scope, receive, sender)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call
| await self.app(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\routing.py", line 670, in call
| await self.middleware_stack(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 2734, in app
| await route.handle(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 1780, in handle
| await self.original_router.handle(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 2789, in handle
| await included_router._handle_selected(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected
| await original_route.handle(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 1279, in handle
| await app(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 158, in app
| await wrap_app_handling_exceptions(app, request)(scope, receive, send)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
| raise exc
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app
| await app(scope, receive, sender)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 144, in app
| response = await f(request)
| ^^^^^^^^^^^^^^^^
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 706, in app
| raw_response = await run_endpoint_function(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ...<3 lines>...
| )
| ^
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\fastapi\routing.py", line 354, in run_endpoint_function
| return await run_in_threadpool(dependant.call, **values)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\starlette\concurrency.py", line 34, in run_in_threadpool
| return await anyio.to_thread.run_sync(func)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\anyio\to_thread.py", line 63, in run_sync
| return await get_async_backend().run_sync_in_worker_thread(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| func, args, abandon_on_cancel=abandon_on_cancel, limiter=limiter
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| )
| ^
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\anyio_backends_asyncio.py", line 2518, in run_sync_in_worker_thread
| return await future
| ^^^^^^^^^^^^
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\anyio_backends_asyncio.py", line 1002, in run
| result = context.run(func, *args)
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\routes\rag.py", line 749, in unlink_folder
| if not folder_sync.delete_folder(folder_id, remove_index = remove_index):
| ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\core\rag\folder_sync.py", line 573, in delete_folder
| conn.execute("BEGIN IMMEDIATE")
| ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
| sqlite3.OperationalError: database is locked
[core.rag.job_leases|WARNING]failed to renew RAG job leases
Traceback (most recent call last):
File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\core\rag\job_leases.py", line 137, in _renew_account
conn.execute(
~~~~~~~~~~~~^
"UPDATE rag_job_leases SET expires_at=? "
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"WHERE kind=? AND job_id=? AND owner_id=?",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(deadline, kind, job_id, _OWNER_ID),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
sqlite3.OperationalError: database is locked
{"timestamp": "2026-10-08T20:17:30.388275Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folders", "status_code": 200, "process_time_ms": 6.25}
{"timestamp": "2026-10-08T20:17:31.379830Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folder-jobs/17fc48ac-70d3-4f37-a004-f2471d9086af", "status_code": 200, "process_time_ms": 6.93}
{"timestamp": "2026-10-08T20:17:31.595816Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/projects/08ee2d4c-2b90-46cd-80e1-fe7cf3ebfb27/documents", "status_code": 200, "process_time_ms": 10.28}
{"timestamp": "2026-10-08T20:17:31.774823Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/inference/monitor", "status_code": 200, "process_time_ms": 4.48}
{"timestamp": "2026-10-08T20:17:31.878558Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/engines", "status_code": 200, "process_time_ms": 14.91}
{"timestamp": "2026-10-08T20:17:33.580356Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folders", "status_code": 200, "process_time_ms": 7.89}
{"timestamp": "2026-10-08T20:17:34.386531Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folders", "status_code": 200, "process_time_ms": 9.18}
{"timestamp": "2026-10-08T20:17:34.393752Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folder-jobs/17fc48ac-70d3-4f37-a004-f2471d9086af", "status_code": 200, "process_time_ms": 6.17}
{"timestamp": "2026-10-08T20:17:35.597939Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/projects/08ee2d4c-2b90-46cd-80e1-fe7cf3ebfb27/documents", "status_code": 200, "process_time_ms": 9.15}
{"timestamp": "2026-10-08T20:17:37.409272Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folder-jobs/17fc48ac-70d3-4f37-a004-f2471d9086af", "status_code": 200, "process_time_ms": 8.12}
{"timestamp": "2026-10-08T20:17:38.391342Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folders", "status_code": 200, "process_time_ms": 6.67}
{"timestamp": "2026-10-08T20:17:39.596943Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/projects/08ee2d4c-2b90-46cd-80e1-fe7cf3ebfb27/documents", "status_code": 200, "process_time_ms": 10.08}
[core.rag.job_leases|WARNING]failed to renew RAG job leases
Traceback (most recent call last):
File "C:\Users\grant.unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\core\rag\job_leases.py", line 137, in _renew_account
conn.execute(
~~~~~~~~~~~~^
"UPDATE rag_job_leases SET expires_at=? "
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"WHERE kind=? AND job_id=? AND owner_id=?",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(deadline, kind, job_id, _OWNER_ID),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
sqlite3.OperationalError: database is locked
{"timestamp": "2026-10-08T20:17:40.423998Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/rag/linked-folder-jobs/17fc48ac-70d3-4f37-a004-f2471d9086af", "status_code": 200, "process_time_ms": 7.08}
{"timestamp": "2026-10-08T20:17:41.803360Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/inference/monitor", "status_code": 200, "process_time_ms": 4.16}

Activity

  1. added
    feature request
    on Oct 8, 2026
  2. changed the title [-][Bug] Please fill in your issue title here.[/-] [+][Bug] No option to stop, pause or cancel embedding of linked folder once it has begun and the process is now stuck indefinitely [/+] on Oct 8, 2026
  3. indrajeetapache commented on Oct 9, 2026

    @indrajeetapache
    Contributor

    What’s going wrong

    Valid bug. Linking a large folder (here: 189 PDFs) starts embedding with a spinner and no Stop / Pause. The only escape is Unlink, which is meant to cancel: delete_folder marks the folder retired, fails active sync jobs, and the worker’s _check_running() stops when it sees that.

    In practice Unlink hits the same SQLite DB the ingest worker is writing. busy_timeout is 5s. While embedding / PDF work holds the writer (the logs also show lease renew failing), BEGIN IMMEDIATE in delete_folder fails:

    DELETE /api/rag/linked-folders/... → 500  sqlite3.OperationalError: database is locked
    

    So the UI looks stuck (0 of 0, spinner comes back after a brief “No linked folder” from the optimistic unlink), and cancel never sticks. Slow/stuck progress on big PDFs can make this worse (related: scanned-PDF GIL work in #13137).

    Path forward

    1. Cancel that does not need the hot write lock first — a process-local cancel Event the worker polls in _check_running (and mid-ingest progress), so Stop / Unlink can signal without waiting on BEGIN IMMEDIATE.
    2. Resilient Unlink — delete_folder requests that cancel first, then retries BEGIN IMMEDIATE with a longer busy timeout so retirement can land once the worker yields the writer.
    3. UI Stop on the running-folder menu (POST /linked-folders/{id}/cancel) so stopping does not require Unlink.

    cc @danielhanchen

  4. indrajeetapache commented on Oct 9, 2026

    @indrajeetapache
    Contributor

    PR for the cancel-under-lock / Stop indexing fix above: #13145

    cc @danielhanchen

  5. self-assigned this
    on Oct 9, 2026
  6. danielhanchen commented on Oct 10, 2026

    @danielhanchen
    Member

    Fixed! Two things kept the folder indexing forever. Files that failed to index (scanned PDFs without OCR) were re-parsed on every automatic sync, so the spinner never stopped. And Unlink waited for the document being embedded, then failed with "database is locked". Files that already failed are now skipped until they change, you click Sync changes, or 6 hours pass, and the folder still lists them as not indexed. Unlink now stops the current document right away, so "Unlink and keep indexed files" works as a stop and keeps everything already indexed. Fixed in #13145.
    To update: Unsloth Desktop will have an update banner. For Studio, use unsloth studio update For Docker, use exec <container> unsloth-studio-update Reopen if it still happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfeature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions