Skip to content

[BUG] Database connection reentry exceptions after data import require application restart #1182

@zerob13

Description

@zerob13

System details / 系统信息

All platforms (Windows, macOS, Linux)

What's wrong? / 出了什么问题?

Description

After users import data into DeepChat, the application does not properly reinitialize the database connection. This causes reentry exceptions when attempting to access the database for subsequent operations. The issue occurs because the database connection pool or connection state is not properly reset or refreshed after the import operation completes.

Currently, the only workaround is to manually restart the DeepChat application after completing a data import, which is inconvenient for users and interrupts their workflow.

Steps to Reproduce

  1. Launch DeepChat application.
  2. Navigate to the data import feature.
  3. Import a data file (e.g., conversation history, settings, or user data).
  4. Wait for the import operation to complete successfully.
  5. Attempt to perform any database-dependent operation without restarting the application (e.g., creating a new conversation, searching history, or modifying settings).
  6. Observe that database connection errors or exceptions occur.

Expected Behavior

  • After data import completes, the application should automatically refresh or reinitialize the database connection to ensure all subsequent database operations work correctly.
  • Users should be able to continue using the application normally without needing to restart.
  • The database connection pool should handle the state change gracefully, either by:
    • Closing and reopening connections
    • Resetting connection pool state
    • Implementing proper transaction isolation for import operations
    • Or automatically prompting the user to restart with a clear explanation if a restart is truly necessary

Actual Behavior

  • Database reentry exceptions occur when attempting to access the database after data import.
  • The application becomes unstable or certain features become unusable until manually restarted.
  • Users must restart the DeepChat client to restore normal database functionality.
  • No clear error message or user guidance is provided about the need to restart.

Workaround

Manually restart the DeepChat application after completing any data import operation.

Additional Context

This issue affects all supported platforms because it is related to the application's database connection management logic rather than any OS-specific behavior. The problem appears to be in the data import module's failure to properly notify or trigger database connection reinitialization after modifying the database schema or data state.

Suggested Solution

  • Implement automatic database connection refresh/reinitialization after data import completes
  • Add proper connection pool management for import operations
  • Alternatively, if restart is required, implement an automatic restart prompt with user confirmation
  • Add error handling to catch these specific reentry exceptions and provide clear guidance to users

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions