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

STARsolo segmentation fault #2593

Open
brgew opened this issue Feb 14, 2025 · 3 comments
Open

STARsolo segmentation fault #2593

brgew opened this issue Feb 14, 2025 · 3 comments

Comments

@brgew
Copy link

brgew commented Feb 14, 2025

Hi,

I am running STARsolo on unaligned BAM files. I get a segmentation fault on some of the input files and these input BAM files have only a few reads.

I compiled STAR-2.7.11b with the gcc address sanitizer and running this executable on a problematic BAM file gives the message

== compile STAR with -fsanitizer=address -Og and run
...

Jan 18 15:48:24 ..... started STAR run
Jan 18 15:48:24 ..... loading genome
Jan 18 15:49:39 ..... started mapping
Jan 18 15:49:40 ..... finished mapping
Jan 18 15:49:42 ..... started Solo counting
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2998837==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x5644a41f34c5 bp 0x7fff82ac2180 sp 0x7fff82ac1fe0 T0)
==2998837==The signal is caused by a READ memory access.
==2998837==Hint: this fault was caused by a dereference of a high value address (see register values below).  Disassemble the provided pc to learn which register was used.
    #0 0x5644a41f34c5 in long long binarySearchExact<unsigned long long>(unsigned long long, unsigned long long*, unsigned long long) /home/brent/src/star/STAR-2.7.11b/source/serviceFuns.cpp:300
    #1 0x5644a420383d in SoloReadFeature::inputRecords(unsigned int**, unsigned int, std::vector<unsigned int, std::allocator<unsigned int> >&, std::vector<readInfoStruct, std::allocator<readInfoStruct> >&, SoloReadFlagClass&, std::vector<unsigned int, std::allocator<unsigned int> >&, std::vector<unsigned int, std::allocator<unsigned int> >&) /home/brent/src/star/STAR-2.7.11b/source/SoloReadFeature_inputRecords.cpp:44
    #2 0x5644a41a6edb in SoloFeature::countCBgeneUMI() /home/brent/src/star/STAR-2.7.11b/source/SoloFeature_countCBgeneUMI.cpp:46
    #3 0x5644a421446e in SoloFeature::processRecords() /home/brent/src/star/STAR-2.7.11b/source/SoloFeature_processRecords.cpp:54
    #4 0x5644a420739e in Solo::processAndOutput() /home/brent/src/star/STAR-2.7.11b/source/Solo.cpp:82
    #5 0x5644a42b25c1 in main /home/brent/src/star/STAR-2.7.11b/source/STAR.cpp:256
    #6 0x14d5ec434d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #7 0x14d5ec434e3f in __libc_start_main_impl ../csu/libc-start.c:392
    #8 0x5644a410f510 in _start (/net/gs/vol1/home/bge/STAR+0x52510)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/brent/src/star/STAR-2.7.11b/source/serviceFuns.cpp:300 in long long binarySearchExact<unsigned long long>(unsigned long long, unsigned long long*, unsigned long long)
==2998837==ABORTING

I added a diagnostic in binarySearchExact() to report the value of N, which turns out to be zero.

Furthermore, adding the lines

    if (N==0)
        return -1;

at the start of binarySearchExact() appears to solve this problem.

I appreciate your consideration.

Thank you.

Ever grateful,
Brent

@zhangjy859
Copy link

Hi @brgew, I encountered the same problem, could you please tell me the specific location you modified, thank you.

@brgew
Copy link
Author

brgew commented Feb 18, 2025

Hi,

The first part of the modified binarySearchExact() looks like

template <class argType>
inline int64 binarySearchExact(argType x, argType *X, uint64 N) {
    //binary search in the sorted list
    //check the boundaries first
    //returns -1 if no match found
    //if X are not all distinct, no guarantee which element is returned

    if (N==0)
        return -1;

    if (x>X[N-1] || x<X[0])
        return -1;

This is at about line 300 in the source/serviceFuns.cpp file.

Ever grateful,
Brent

@zhangjy859
Copy link

zhangjy859 commented Feb 19, 2025

Hi @brgew

Thank you for your reply, this solution seems to not work in my issue. In my case, it was finally found that an extra blank line was introduced in the readFilesManifest file, which caused this error. But again, thank you for your kind help.

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