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

Segfault in souffleprof #2229

Closed
langston-barrett opened this issue Mar 17, 2022 · 4 comments · Fixed by #2230
Closed

Segfault in souffleprof #2229

langston-barrett opened this issue Mar 17, 2022 · 4 comments · Fixed by #2230
Labels
bug - identified Bugs with an identified cause

Comments

@langston-barrett
Copy link
Contributor

souffle --version
Souffle: 2.2-129-gfce85d9ec(32bit Domains)
Copyright (c) 2016-19 The Souffle Developers.
Copyright (c) 2013-16 Oracle and/or its affiliates.

GDB backtrace:

#0  souffle::profile::Reader::processFile (this=0xe4e088) at ../src/include/souffle/profile/Reader.h:343
#1  0x000000000024b6a9 in souffle::profile::Tui::updateDB (this=0x7ffcca36c9e8)
    at ../src/include/souffle/profile/Tui.h:1468
#2  0x00000000002495bf in souffle::profile::Tui::Tui (this=0x7ffcca36c9e8, filename=..., live=<optimized out>)
    at ../src/include/souffle/profile/Tui.h:95
#3  0x00000000002393fa in souffle::profile::Cli::parse (this=0x7ffcca36cbc8) at ../src/include/souffle/profile/Cli.h:89
#4  0x0000000000232d9f in main (argc=<optimized out>, argv=<optimized out>) at ../src/souffle_prof.cpp:23

prof.json.zip

@langston-barrett
Copy link
Contributor Author

ASan gives a bit more detail:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==2475==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000088 (pc 0x000000409c3b bp 0x7ffd98ebd550 sp 0x7ffd98ebd530 T0)
==2475==The signal is caused by a READ memory access.
==2475==Hint: address points to the zero page.
    #0 0x409c3b in souffle::profile::Relation::addReads(unsigned long) /mate/souffle/build/../src/include/souffle/profile/Relation.h:249:26
    #1 0x400a74 in souffle::profile::Reader::processFile() /mate/souffle/build/../src/include/souffle/profile/Reader.h:343:52
    #2 0x3d3cf7 in souffle::profile::Tui::updateDB() /mate/souffle/build/../src/include/souffle/profile/Tui.h:1468:17
    #3 0x3cfba2 in souffle::profile::Tui::Tui(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, bool) /mate/souffle/build/../src/include/souffle/profile/Tui.h:95:9
    #4 0x38a3ca in souffle::profile::Cli::parse() /mate/souffle/build/../src/include/souffle/profile/Cli.h:89:13
    #5 0x374035 in main /mate/souffle/build/../src/souffle_prof.cpp:23:13
    #6 0x7f3856ecd0b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
    #7 0x2c96dd in _start (/mate/souffle/build-asan/src/souffleprof+0x2c96dd)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /mate/souffle/build/../src/include/souffle/profile/Relation.h:249:26 in souffle::profile::Relation::addReads(unsigned long)
==2475==ABORTING

@langston-barrett
Copy link
Contributor Author

With this diff:

diff --git a/src/include/souffle/profile/Reader.h b/src/include/souffle/profile/Reader.h
index 1e93980c5..7df098035 100644
--- a/src/include/souffle/profile/Reader.h
+++ b/src/include/souffle/profile/Reader.h
@@ -329,6 +329,9 @@ public:
             for (const auto& rule : relation.second->getRuleMap()) {
                 for (const auto& atom : rule.second->getAtoms()) {
                     std::string relationName = extractRelationNameFromAtom(atom);
+                    std::cout << "NAME " << relationName << std::endl;
+                    std::cout << "ATOM " << atom.identifier << std::endl;
+                    std::cout << "REL " << relationMap[relationName] << std::endl;
                     relationMap[relationName]->addReads(atom.frequency);
                 }
             }
@@ -340,6 +343,9 @@ public:
                             relationName = relationName.substr(7);
                         }
                         assert(relationMap.count(relationName) > 0 || "Relation name for atom not found");
+                        std::cout << "NAME " << relationName << std::endl;
+                        std::cout << "ATOM " << atom.identifier << std::endl;
+                        std::cout << "REL " << relationMap[relationName] << std::endl;
                         relationMap[relationName]->addReads(atom.frequency);
                     }
                 }

I see:

NAME @new_unification.unify_repr_aux
ATOM @new_unification.unify_repr_aux
REL (nil)
Segmentation fault (core dumped)

There's some subsumption going on in my source program for unify_repr_aux, so I suspect this has something to do with that.

@b-scholz
Copy link
Member

We have not tested the profile for subsumption.

@b-scholz
Copy link
Member

Can you produce a small test-case?

@b-scholz b-scholz added the bug - identified Bugs with an identified cause label Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - identified Bugs with an identified cause
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants