Fix segfault on opening multiple threads for one entry in thread list by matthiasbeyer · Pull Request #696 · astroidmail/astroid · GitHub
Skip to content

Fix segfault on opening multiple threads for one entry in thread list#696

Open
matthiasbeyer wants to merge 2 commits into
astroidmail:masterfrom
matthiasbeyer:fix-segfault-on-multiple-threads-for-id
Open

Fix segfault on opening multiple threads for one entry in thread list#696
matthiasbeyer wants to merge 2 commits into
astroidmail:masterfrom
matthiasbeyer:fix-segfault-on-multiple-threads-for-id

Conversation

@matthiasbeyer

Copy link
Copy Markdown
Contributor

This is my take on #695

I'm not a C++ dev though (mainly I'm a Rust dev), thus I guess this is something one might not want to have here.

For my case, it fixes the crash when opening a thread where notmuch returns multiple threads for one thread id.
Please have a look.

This is necessary if we want to execute the closure for each found
thread.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
@matthiasbeyer

Copy link
Copy Markdown
Contributor Author

@gauteh

gauteh commented Jul 22, 2020

Copy link
Copy Markdown
Member

Thanks, Only one additional pane is show

@gauteh

gauteh commented Jul 22, 2020

Copy link
Copy Markdown
Member

on_thread is used several places, not sure if it is safe to apply the function to all threads. E.g. a user-defined hook to delete a thread. Why does notmuch return several threads? Is it a notmuch bug? Maybe it is safer to work on the first thread if we cannot avoid the underlying issue?

@matthiasbeyer

Copy link
Copy Markdown
Contributor Author

TBH I don't know. But I've experienced this before in notmuch. As far as I can see, nothing (in the notmuch docs) says that for a thread:<thread id> query, notmuch does only return one thread.

So I guess it is actually expected to return multiple thread and the bug is on our side here when we expect only one thread to be returned.

@gauteh

gauteh commented Jul 22, 2020 via email

Copy link
Copy Markdown
Member

@matthiasbeyer

Copy link
Copy Markdown
Contributor Author

@gauteh

gauteh commented Jul 22, 2020 via email

Copy link
Copy Markdown
Member

@matthiasbeyer

Copy link
Copy Markdown
Contributor Author

Does the threads always contain the same messages?

Not sure what you mean by that.

From what I see in the codebase right now, Db::on_thread is not used too extensively. Maybe it would be worth a try to check all cases and rewrite it to not expect there be only one thread anymore?

@gauteh

gauteh commented Jul 22, 2020 via email

Copy link
Copy Markdown
Member

@mreppen

mreppen commented Aug 5, 2020

Copy link
Copy Markdown

I have solved this problem by running notmuch reindex on the first of such split threads. This corrects it to one thread. Is there a reason this could not be attempted by astroid as a convenience to the user? Or does reindexing potentially cause problems?

@matclab

matclab commented Jan 7, 2021

Copy link
Copy Markdown

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.

4 participants