Skip to content

fix: lifetime of EspeakWrapper cannot be dropped - #224

Merged
mmmaat merged 2 commits into
bootphon:masterfrom
Decodetalkers:fix/un_recycled_lifetime
Sep 30, 2026
Merged

mmmaat merged 2 commits into
bootphon:masterfrom
Decodetalkers:fix/un_recycled_lifetime

Conversation

@Decodetalkers

@Decodetalkers Decodetalkers commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

resolve: #223

because in available_voices the function is marked as lru cache, and every time a EspeakBackend is inited, it will call support_languages once, this will cause the lifetime of one wrapper be hunge on once the function is invoked. And if with multi thread, every time the thread forks, the init will be called, again, and more support_languages() will be called, then it will cause huge amount of folder being created under /tmp file, and last fd will run out, task will panic and exit

because in available_voices the function is marked as lru cache, and
every time a EspeakBackend is inited, it will call support_languages
once, this will cause the lifetime of one wrapper be hunge on once the
function is invoked. And if with multi thread, every time the thread
forks, the __init__ will be called, again, and more support_languages()
will be called, then it will cause huge amount of folder being created
under /tmp file, and last fd will run out, task will panic and exit
@Decodetalkers Decodetalkers changed the title fix: lifetime of EspeakWrapper cannot be drop fix: lifetime of EspeakWrapper cannot be dropped Sep 29, 2026
@Decodetalkers

Decodetalkers commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

this did fix my problem.. before , after I ran it to 76 epoch, I will get 5000 folders.. then my program panic.. is this feature added recently? at least the author seems has run to the every end

cannot believe one day I meet the gc problem in python

@Decodetalkers

Copy link
Copy Markdown
Contributor Author

@mmmaat friendly ping. This will become a huge problem when using Espeak in multi threads

@mmmaat

mmmaat commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Hi, please update the CHANGELOG as well and I'll merge it, thanks.

@Decodetalkers

Copy link
Copy Markdown
Contributor Author

Hi, please update the CHANGELOG as well and I'll merge it, thanks.

Thank you , added!

@mmmaat
mmmaat merged commit 8eac8d6 into bootphon:master Sep 30, 2026
7 checks passed
@mmmaat

mmmaat commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

close #223

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lru cache hold the lifetime make espeaker cannt drop

2 participants