Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Segfaults while using the search functionality #598

Closed
zoopp opened this issue Jul 13, 2018 · 8 comments
Closed

Segfaults while using the search functionality #598

zoopp opened this issue Jul 13, 2018 · 8 comments
Assignees
Labels

Comments

@zoopp
Copy link

zoopp commented Jul 13, 2018

Platform version: Linux (archlinux latest)
Sourcetrail version: 2018.2.77
Description of the problem: Sourcetrail crashes with a segfault when I'm using the search box to input search queries. This seems to happen only on one of the indexes that I use and only when the query starts with the letter 't'. I did notice that it's less likely for it to crash if I type my query slower, for example, if I type tv in the search box then the program will in 99% of the cases instantly crash however If I type t wait 2-3 seconds followed by v then sometimes it will survive.
Steps to reproduce the problem: Type queries in the search box.

Unfortunately I cannot share the index for debugging purposes but I hope the description along with the log bellow can give you some clues as to where the problem might lie.

15:21:36 | Application.cpp:423 logStorageStats() | INFO: 
Graph:
	1132112 Nodes
	5234828 Edges

Code:
	24776 Files
	7422380 Lines of Code

Errors:
	7229 Errors
	0 Fatal Errors

15:21:36 | BookmarkController.cpp:468 getBookmarks() | INFO: Retrieving bookmarks with filter "1" and order "2"
15:21:36 | BookmarkController.cpp:429 getAllBookmarks() | INFO: Retrieving all bookmarks
15:21:36 | INFO: send MessageRefresh ui 
15:21:36 | INFO: send MessageSearch @overview
15:21:36 | INFO: send MessageActivateAll 
15:21:44 | GraphController.cpp:1372 bundleNodesByType() | ERROR: Nodes left after bundling for overview
15:21:48 | INFO: send MessageWindowFocus 
15:21:48 | INFO: send MessagePingReceived 
15:21:49 | INFO: send MessageWindowFocus 
15:21:49 | INFO: send MessageWindowFocus 
15:21:49 | INFO: send MessagePingReceived 
15:21:52 | INFO: send MessageSearchAutocomplete t[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288]
15:21:52 | SearchController.cpp:89 handleMessage() | INFO: autocomplete string: "t"
Segmentation fault (core dumped)
@zoopp zoopp changed the title Random segfaults while using the search box Segfaults while using the search functionality Jul 13, 2018
@egraether egraether added the bug label Jul 13, 2018
@egraether
Copy link
Contributor

That must be a very rare edge case in our search algorithm then.

Can you please see if you can find the core dump file for this crash. It would be really helpful. I'm not exactly sure where you can find it on ArchLinux, maybe this helps: https://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory?answertab=votes#tab-top

@zoopp
Copy link
Author

zoopp commented Jul 13, 2018

I did some quick greps on the core dump for some keywords contained by the index and I got positive matches so I'm unable to send you a core dump due to risk of exposing what some of the people that I work with would consider sensitive information. I realize that this will be less efficient but perhaps we could figure it out another way.

This is the backtrace that I got by running Sourcetrail through gdb when it crashed:

(gdb) bt
#0  0x00007ffff4df32ce in isupper () from /usr/lib/libc.so.6
#1  0x0000000000d6aeaf in SearchIndex::scoreText(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&) ()
#2  0x0000000000d7183b in SearchIndex::rescoreText(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, int, unsigned long) ()
#3  0x0000000000c74aa6 in PersistentStorage::getAutocompletionMatches(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, NodeTypeSet) const ()
#4  0x0000000000c49a5e in StorageAccessProxy::getAutocompletionMatches(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, NodeTypeSet) const ()
#5  0x0000000000c3943b in SearchController::handleMessage(MessageSearchAutocomplete*) ()
#6  0x0000000000bc7787 in ?? ()
#7  0x0000000000bcf135 in TaskLambda::doUpdate(std::shared_ptr<Blackboard>) ()
#8  0x0000000000bca9a2 in Task::update(std::shared_ptr<Blackboard>) ()
#9  0x0000000000bcf3b9 in TaskRunner::update(std::shared_ptr<Blackboard>) ()
#10 0x0000000000bced64 in TaskGroupSequence::doUpdate(std::shared_ptr<Blackboard>) ()
#11 0x0000000000bca9a2 in Task::update(std::shared_ptr<Blackboard>) ()
#12 0x0000000000bcf3b9 in TaskRunner::update(std::shared_ptr<Blackboard>) ()
#13 0x0000000000bd0f94 in TaskScheduler::processTasks() ()
#14 0x0000000000bd1631 in TaskScheduler::startSchedulerLoop() ()
#15 0x00000000026d1bf0 in ?? ()
#16 0x00007ffff759e075 in start_thread () from /usr/lib/libpthread.so.0
#17 0x00007ffff4ebc53f in clone () from /usr/lib/libc.so.6

I do have to admit though it does look weird that the segfault occurred in isupper.

@egraether
Copy link
Contributor

Thank you, that looks useful! Probably an access at the wrong index, i will look into it.

@egraether egraether self-assigned this Jul 13, 2018
@egraether
Copy link
Contributor

Should be fixed with 2018.2.105

The isupper() function can have undefined behavior when used with wchar_t, which we introduced a couple months ago. I switched to iswupper().

We will release a new beta build next week, I will let you know when it's available.

@egraether
Copy link
Contributor

New beta release is available. Can you please test if this issue is still present?
download beta

@zoopp
Copy link
Author

zoopp commented Jul 24, 2018

I'll reindex and give it a go. This might take a while though.

@zoopp
Copy link
Author

zoopp commented Jul 25, 2018

@egraether I am not able to reproduce the issue using the beta version. Seems like this was it.

@egraether
Copy link
Contributor

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants