Skip to content

[Bug] Close KyuubiSession when OperationLog not initialized may lead log file leak #5832

@Flyangz

Description

@Flyangz

Code of Conduct

Search before asking

  • I have searched in the issues and found no similar issues.

Describe the bug

I added some debug logs and got the below pictures.
截屏2023-12-08 11 09 01
We can see kyuubi received a close session request and closed corresponding operation logs. Let say thread A done this work. One log was closed before initialized, so the the OperationLog#close call did not close writer.

def close(): Unit = synchronized {
if (!initialized) return

After that, OperationLog#write was called by other thread B. Finally, the thread A called SessionManager#deleteOperationLogSessionDir and cause log file leak.
截屏2023-12-08 11 15 04

Affects Version(s)

1.7.1 with #5211 patch

Kyuubi Server Log Output

No response

Kyuubi Engine Log Output

No response

Kyuubi Server Configurations

No response

Kyuubi Engine Configurations

No response

Additional context

Maybe we can delete if (!initialized) return to fix it?

Are you willing to submit PR?

  • Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
  • No. I cannot submit a PR at this time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions