Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segmentation fault #1

Open
mdieser opened this issue Oct 26, 2018 · 6 comments
Open

segmentation fault #1

mdieser opened this issue Oct 26, 2018 · 6 comments

Comments

@mdieser
Copy link

mdieser commented Oct 26, 2018

Hi - Thank you for making this script available. I have been running into several segmentation faults, some I could solve but I'm not sure how to approach this one. When I check the core file I get the following output:

gdb HGTFinder core
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from HGTFinder...(no debugging symbols found)...done.
[New LWP 21569]
Core was generated by `./HGTFinder -d CG23.2.blast.out -s Janthino.CG23.2.blast.self -t 1706231 -o HGT'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000000000041f2eb in DBContainer::operator[](std::__cxx11::basic_string<char, std::char_traits, std::allocator >&) ()

Do you have any suggestion what could cause this segmentation fault in the DBcontainer files?

Best,

Markus

@mdieser
Copy link
Author

mdieser commented Oct 30, 2018

additional info using the backtracker
(gdb) bt
#0 0x000000000041f2eb in DBContainer::operator[](std::__cxx11::basic_string<char, std::char_traits, std::allocator >&) ()
#1 0x000000000042470c in Blast::readSelfBlast(DBContainer&) ()
#2 0x000000000040361d in main ()

@alex-ekstrom
Copy link

I'm relatively certain that adding size = size / sizeof(int); after line 29 would fix this. This was caused due to a desync between ORFanFinder and HTGFinder when shared code was changed. Realistically, the correct approach is to break the code out and create a shared dependency, but that is quite a lot of work in C++. For now, adding that line will likely suffice.

It would be best if we had some test data to make sure that this fix works. There may have been some other change that I'm forgetting that would also need to be made.

@mdieser
Copy link
Author

mdieser commented Nov 8, 2018

Thank you for your response. For clarification, I added the line to the DBContaier.cc file after line 29 as shown below. Is this the correct place as the file contains empty lines? Unfortunately, I still get the same segmentation fault.
Based on your reply, is there a different version available than the one on github (updated last 7 months ago)? Is the ORFanFinder a dependency as it was not part of the download?

Thanks,

Markus

#include "DBContainer.h"

#include
#include

using std::ifstream;
using std::cerr;
using std::endl;
using std::ios;

void DBContainer::init(const char* dbFile){
avail = true;

ifstream file(dbFile, ios::in|ios::binary|ios::ate);
int size = ((int)file.tellg()-1)/2;
file.close();

file.open(dbFile, ios::in|ios::binary);
if(file.good()){
	file.read(&checkBits, 1);
	taxBits = sizeof(int)*8 - checkBits;

	seeds.resize(size/sizeof(int));
	int* seedArray = seeds.data();
	file.read((char*)seedArray, size);

	values.resize(size/sizeof(int));
            int* valArray = values.data();
            file.read((char*)valArray, size);
    size = size / sizeof(int);
}else{
	cerr << dbFile << " is invalid." << endl;
	avail = false;
}
file.close();

}

@alex-ekstrom
Copy link

Sorry, my comment above was really more of a running commentary aimed towards maintainers. ORFanFinder is not a dependency, but it does share some code HTGFinder. However, there have been times where one has been modified without the other, and we'll need to reconcile that.

@mdieser
Copy link
Author

mdieser commented Nov 9, 2018

Just to be clear, is there anything I can do to fix the problem?

@alex-ekstrom
Copy link

No, I think this is something that we will have to debug.

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

No branches or pull requests

2 participants