Skip to content

DO NOT MERGE Add mechanism to install memory error handler for finding segfaults in compiler#11574

Closed
schveiguy wants to merge 1 commit intodlang:masterfrom
schveiguy:trymemerrhandler
Closed

DO NOT MERGE Add mechanism to install memory error handler for finding segfaults in compiler#11574
schveiguy wants to merge 1 commit intodlang:masterfrom
schveiguy:trymemerrhandler

Conversation

@schveiguy
Copy link
Copy Markdown
Member

@schveiguy schveiguy commented Aug 15, 2020

This is simply a test. It should run the specified test with the memory error signal handler enabled.

Now going to try and instrument all Linux tests to catch the segfault error. After we find it we can move the d_do_test back to a normal run.

src/dmd/mars.d Outdated
{
import core.runtime;
import core.memory;
// install the memory error handler when the environment variable is set
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/dmd/mars.d:908:16: error: module memoryerror is in file 'etc/linux/memoryerror.d' which cannot be read
  908 |         import etc.linux.memoryerror;
      |                ^
import path[0] = /usr/lib/gcc/x86_64-linux-gnu/9/include/d
import path[1] = /home/runner/dmd/src

As LDC or GDC might be host compilers too, I would simply use version (DigitalMars).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to merge this to test further, I will. For now, just trying to see if I can duplicate the problem on this PR.

Copy link
Copy Markdown
Contributor

@wilzbach wilzbach Aug 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still believe there's merit of keeping the memory error registration enabled as it will likely help with other hard-to-replicate bugs that appear on the CI machines.

@schveiguy schveiguy marked this pull request as ready for review August 15, 2020 14:27
@schveiguy
Copy link
Copy Markdown
Member Author

ok @wilzbach I saw DMD master failed with the core dump. I have deprecated like 10 jobs to try and get it to happen on this PR, but we aren't going to catch it unless it's done for every test.

We can revert this if people find objection to it, but I think it's a reasonable thing to include for testing.

I fixed the LDC/GDC issue.

@wilzbach wilzbach added the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Aug 15, 2020
@schveiguy schveiguy changed the title DO NOT MERGE Try to figure out if the memory error handler helps with the coredump Add mechanism to install memory error handler for finding segfaults in compiler Aug 15, 2020
@dlang-bot
Copy link
Copy Markdown
Contributor

Thanks for your pull request, @schveiguy!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#11574"

@UplinkCoder
Copy link
Copy Markdown
Member

I fear this will need a little explaining.
Does this find potential segfaults?
If so, how?

@wilzbach
Copy link
Copy Markdown
Contributor

I fear this will need a little explaining.
Does this find potential segfaults?
If so, how?

No, it just allows us to see the segfault. You can read up more in the documentation of the memory error handler.

@schveiguy
Copy link
Copy Markdown
Member Author

@UplinkCoder if we are lucky, the segfault will print a stack trace.

Copy link
Copy Markdown
Contributor

@MoonlightSentinel MoonlightSentinel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but please update the commit title & description

@schveiguy
Copy link
Copy Markdown
Member Author

@MoonlightSentinel done (I think this is what you meant?)

@schveiguy
Copy link
Copy Markdown
Member Author

schveiguy commented Aug 16, 2020

Got a hit! Anyone know what this stack trace means?

etc.linux.memoryerror.InvalidPointerError@src/etc/linux/memoryerror.d(328)
----------------
??:? void etc.linux.memoryerror.sigsegvUserspaceProcess(void*) [0x98a177]
??:? void etc.linux.memoryerror.sigsegvDataHandler() [0x98a05e]
??:? dmd.mtype.Type dmd.typesem.typeSemantic(dmd.mtype.Type, ref const(dmd.globals.Loc), dmd.dscope.Scope*).visitFunction(dmd.mtype.TypeFunction) [0x826fa8]
??:? _Z12typeSemanticP4TypeRK3LocP5Scope [0x824ed9]
??:? _ZN22DsymbolSemanticVisitor23funcDeclarationSemanticEP15FuncDeclaration [0x6571a5]
??:? _ZN22DsymbolSemanticVisitor5visitEP15FuncDeclaration [0x659414]
??:? _ZN15FuncDeclaration6acceptEP7Visitor [0x6f1d1c]
??:? void dmd.dsymbolsem.DsymbolSemanticVisitor.visit(dmd.dstruct.StructDeclaration).__lambda5!(dmd.dsymbol.Dsymbol).__lambda5(dmd.dsymbol.Dsymbol) [0x65d123]
??:? _ZN22DsymbolSemanticVisitor5visitEP17StructDeclaration [0x65c14d]
??:? _ZN17StructDeclaration6acceptEP7Visitor [0x63f800]
??:? _ZN22DsymbolSemanticVisitor14attribSemanticEP17AttribDeclaration [0x64d975]
??:? _ZN22DsymbolSemanticVisitor5visitEP17AttribDeclaration [0x64db10]
??:? _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP23StorageClassDeclaration [0x7e5f42]
??:? _ZN23StorageClassDeclaration6acceptEP7Visitor [0x5960b8]
??:? _ZN25ExpressionSemanticVisitor5visitEP14DeclarationExp [0x6ca7ed]
??:? _ZN14DeclarationExp6acceptEP7Visitor [0x6a97e0]
??:? _ZN24StatementSemanticVisitor5visitEP12ExpStatement [0x7f9fca]
??:? _ZN12ExpStatement6acceptEP7Visitor [0x7f56d0]
??:? _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fa4f2]
??:? _ZN17CompoundStatement6acceptEP7Visitor [0x7f6094]
??:? _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0x7ee587]
??:? _ZN15FuncDeclaration6acceptEP7Visitor [0x6f1d1c]
??:? _ZN16Semantic3Visitor5visitEP16TemplateInstance [0x7ec317]
??:? _ZN16TemplateInstance6acceptEP7Visitor [0x67d76c]
??:? void dmd.dtemplate.TemplateInstance.trySemantic3(dmd.dscope.Scope*) [0x67d735]
??:? void dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) [0x66346a]
??:? void dmd.dtemplate.functionResolve(ref dmd.declaration.MatchAccumulator, dmd.dsymbol.Dsymbol, dmd.globals.Loc, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, const(char)**) [0x6711a6]
??:? dmd.func.FuncDeclaration dmd.func.resolveFuncCall(ref const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.dsymbol.Dsymbol, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, dmd.func.FuncResolveFlag) [0x6f2d5f]
??:? _ZN25ExpressionSemanticVisitor5visitEP7CallExp [0x6c7916]
??:? _ZN7CallExp6acceptEP7Visitor [0x6ac2a8]
??:? bool dmd.expressionsem.arrayExpressionSemantic(dmd.root.array.Array!(dmd.expression.Expression).Array*, dmd.dscope.Scope*, bool) [0x6b3f50]
??:? _ZN25ExpressionSemanticVisitor5visitEP7CallExp [0x6c569a]
??:? _ZN7CallExp6acceptEP7Visitor [0x6ac2a8]
??:? dmd.expression.Expression dmd.expressionsem.unaSemantic(dmd.expression.UnaExp, dmd.dscope.Scope*) [0x6e74df]
??:? _ZN25ExpressionSemanticVisitor5visitEP9AssertExp [0x6cf62f]
??:? _ZN9AssertExp6acceptEP7Visitor [0x6ab26c]
??:? _ZN24StatementSemanticVisitor5visitEP12ExpStatement [0x7f9fca]
??:? _ZN12ExpStatement6acceptEP7Visitor [0x7f56d0]
??:? _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fa4f2]
??:? _ZN17CompoundStatement6acceptEP7Visitor [0x7f6094]
??:? _ZN24StatementSemanticVisitor5visitEP19TryFinallyStatement [0x80b4db]
??:? _ZN19TryFinallyStatement6acceptEP7Visitor [0x7f857c]
??:? _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7faae3]
??:? _ZN17CompoundStatement6acceptEP7Visitor [0x7f6094]
??:? _ZN24StatementSemanticVisitor5visitEP19TryFinallyStatement [0x80b4db]
??:? _ZN19TryFinallyStatement6acceptEP7Visitor [0x7f857c]
??:? _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7faae3]
??:? _ZN17CompoundStatement6acceptEP7Visitor [0x7f6094]
??:? _ZN24StatementSemanticVisitor5visitEP19TryFinallyStatement [0x80b4db]
??:? _ZN19TryFinallyStatement6acceptEP7Visitor [0x7f857c]
??:? _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7faae3]
??:? _ZN17CompoundStatement6acceptEP7Visitor [0x7f6094]
??:? _ZN24StatementSemanticVisitor5visitEP19TryFinallyStatement [0x80b4db]
??:? _ZN19TryFinallyStatement6acceptEP7Visitor [0x7f857c]
??:? _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7faae3]
??:? _ZN17CompoundStatement6acceptEP7Visitor [0x7f6094]
??:? _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0x7ee587]
??:? _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP19UnitTestDeclaration [0x7e5e55]
??:? _ZN19UnitTestDeclaration6acceptEP7Visitor [0x6f5530]
??:? _ZN16Semantic3Visitor5visitEP17AttribDeclaration [0x7f25e8]
??:? _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP15ProtDeclaration [0x7e5f22]
??:? _ZN15ProtDeclaration6acceptEP7Visitor [0x597494]
??:? _ZN16Semantic3Visitor5visitEP20AggregateDeclaration [0x7f286c]
??:? _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP17StructDeclaration [0x7e5fb5]
??:? _ZN17StructDeclaration6acceptEP7Visitor [0x63f800]
??:? _ZN16Semantic3Visitor5visitEP16TemplateInstance [0x7ec317]
??:? _ZN16TemplateInstance6acceptEP7Visitor [0x67d76c]
??:? _ZN16Semantic3Visitor5visitEP6Module [0x7ecc72]
??:? _ZN6Module6acceptEP7Visitor [0x61b770]
??:? int dmd.mars.tryMain(ulong, const(char)**, ref dmd.globals.Param) [0x789032]
??:? _Dmain [0x78ac58]

Unfortunately no line numbers (I think because this is the release build).

@MoonlightSentinel
Copy link
Copy Markdown
Contributor

Unfortunately no line numbers (I think because this is the release build).

dmd is build with ENABLE_RELEASE=1 which disables debug information ...

@schveiguy
Copy link
Copy Markdown
Member Author

Ugh, it's not a null pointer, so this is a memory corruption or dangling pointer issue.

@schveiguy
Copy link
Copy Markdown
Member Author

I suppose the next step is to instrument that function visitFunction, and print how far we got? It's a HUGE function.

@wilzbach
Copy link
Copy Markdown
Contributor

Well, I think #11519 (comment) should have fixed this particular issue, so I am not sure whether you'll be able to replicate it.

However, it looks like the GC (-lowmem) is cleaning up memory that is still in used and that will be hard to debug remotely. AFAICT we would be more effective by trying to replicate it locally.

@MoonlightSentinel
Copy link
Copy Markdown
Contributor

MoonlightSentinel commented Aug 16, 2020

Note that the auto-tester prefers the host dmd now that #11519 was merged. So you'll probably need to revert this change in this/another PR to replicate the failure. Also DMD needs to be build with debug information to actually make use the stack trace.

@wilzbach Maybe debug information should be enabled by default on the CI's? (esp. as a complement to the pending ENABLE_ASSERTS PR? )

@schveiguy
Copy link
Copy Markdown
Member Author

However, it looks like the GC (-lowmem) is cleaning up memory that is still in used and that will be hard to debug remotely. AFAICT we would be more effective by trying to replicate it locally.

Yeah, that's probably true. The other possibility is that there is some stack data that is being returned.

However, from experience with memory errors, I suspect that reproducing it locally is going to be really challenging. And even if you do reproduce it locally, even in a debugger, it may be too late to see what the cause is.

Using the host compiler means we likely don't hit this error any more. So I guess that's a solution. But I can rebase this and leave the PR open (It should keep testing and maybe we hit this bug again). I will try to see if using the debug build can cause the failure.

@wilzbach
Copy link
Copy Markdown
Contributor

Maybe debug information should be enabled by default on the CI's?

Debug information should already always be present on the CIs...

@wilzbach
Copy link
Copy Markdown
Contributor

But I can rebase this and leave the PR open (It should keep testing and maybe we hit this bug again).

All CIs do rebases automatically. You would need to add a revert of the host compiler change PR.

@MoonlightSentinel
Copy link
Copy Markdown
Contributor

Debug information should already always be present on the CIs...

The auto-tester builds with ENABLE_RELEASE=1...

@MoonlightSentinel
Copy link
Copy Markdown
Contributor

No clue ATM but you could keep the release build and manually enable debug information instead:

diff --git a/src/posix.mak b/src/posix.mak
index 2c309b00c..6840e83ba 100644
--- a/src/posix.mak
+++ b/src/posix.mak
@@ -99,7 +99,7 @@ else
   HOST_DMD_RUN=$(HOST_DMD) -conf=$(dir $(HOST_DMD))dmd.conf
 endif

-RUN_BUILD = $(GENERATED)/build HOST_DMD="$(HOST_DMD)" CXX="$(HOST_CXX)" OS=$(OS) BUILD=$(BUILD) MODEL=$(MODEL) AUTO_BOOTSTRAP="$(AUTO_BOOTSTRAP)" DOCDIR="$(DOCDIR)" STDDOC="$(STDDOC)" DOC_OUTPUT_DIR="$(DOC_OUTPUT_DIR)" MAKE="$(MAKE)" --called-from-make
+RUN_BUILD = $(GENERATED)/build HOST_DMD="$(HOST_DMD)" CXX="$(HOST_CXX)" OS=$(OS) BUILD=$(BUILD) MODEL=$(MODEL) AUTO_BOOTSTRAP="$(AUTO_BOOTSTRAP)" DOCDIR="$(DOCDIR)" STDDOC="$(STDDOC)" DOC_OUTPUT_DIR="$(DOC_OUTPUT_DIR)" MAKE="$(MAKE)" DFLAGS="$(DFLAGS) -g" --called-from-make

 ######## Begin build targets

@schveiguy
Copy link
Copy Markdown
Member Author

OK, I did that. You think this will work? I suppose actually debug info is more important than debug build -- changing to debug build might affect whether the segfault happens.

@MoonlightSentinel
Copy link
Copy Markdown
Contributor

Yes, the last few FreeBSD runs segfaulted using the release build.

May need to overwrite ENABLE_RELEASE in RUN_BUILD if the optimizer screws with the debug information...

@schveiguy
Copy link
Copy Markdown
Member Author

By "still work" I meant, will it now print line numbers ;)

@schveiguy schveiguy force-pushed the trymemerrhandler branch 2 times, most recently from 9416911 to ed2f553 Compare August 17, 2020 00:03
@MoonlightSentinel
Copy link
Copy Markdown
Contributor

MoonlightSentinel commented Aug 17, 2020

EDIT: To many tabs

@schveiguy
Copy link
Copy Markdown
Member Author

And I'm waiting for my latest change to be tested, which I hope works...

@schveiguy
Copy link
Copy Markdown
Member Author

OK, I think this is back to actually working how it should. Now we just need another coredump...

@MoonlightSentinel MoonlightSentinel removed the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Aug 19, 2020
@MoonlightSentinel
Copy link
Copy Markdown
Contributor

Rebased it again (removed --called-from-make in #11515 )

@schveiguy
Copy link
Copy Markdown
Member Author

@MoonlightSentinel thanks!

@schveiguy
Copy link
Copy Markdown
Member Author

Another hit, this time with line numbers, and on 32-bit linux.

etc.linux.memoryerror.InvalidPointerError@src/etc/linux/memoryerror.d(328)
----------------
??:? void etc.linux.memoryerror.sigsegvUserspaceProcess(void*) [0x98c7b7]
??:? void etc.linux.memoryerror.sigsegvDataHandler() [0x98c69e]
src/dmd/typesem.d:1564 dmd.mtype.Type dmd.typesem.typeSemantic(dmd.mtype.Type, ref const(dmd.globals.Loc), dmd.dscope.Scope*).visitFunction(dmd.mtype.TypeFunction) [0x829e39]
src/dmd/typesem.d:1972 _Z12typeSemanticP4TypeRK3LocP5Scope [0x826e99]
src/dmd/dtemplate.d:1193 dmd.globals.MATCH dmd.dtemplate.TemplateDeclaration.matchWithInstance(dmd.dscope.Scope*, dmd.dtemplate.TemplateInstance, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.root.array.Array!(dmd.expression.Expression).Array*, int) [0x66de89]
src/dmd/dtemplate.d:6956 int dmd.dtemplate.TemplateInstance.findBestMatch(dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*).__lambda3(dmd.dsymbol.Dsymbol) [0x67d7bb]
src/dmd/func.d:2707 int dmd.func.overloadApply(dmd.dsymbol.Dsymbol, int delegate(dmd.dsymbol.Dsymbol), dmd.dscope.Scope*) [0x6f339e]
src/dmd/dtemplate.d:6930 bool dmd.dtemplate.TemplateInstance.findBestMatch(dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) [0x67cf1d]
src/dmd/dsymbolsem.d:5940 void dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) [0x663033]
src/dmd/dsymbolsem.d:2840 _ZN22DsymbolSemanticVisitor5visitEP16TemplateInstance [0x654ed5]
src/dmd/dtemplate.d:7506 _ZN16TemplateInstance6acceptEP7Visitor [0x67e888]
src/dmd/expressionsem.d:3285 _ZN25ExpressionSemanticVisitor5visitEP8ScopeExp [0x6c0da5]
src/dmd/expression.d:3328 _ZN8ScopeExp6acceptEP7Visitor [0x6a8ed8]
src/dmd/expressionsem.d:12068 dmd.expression.Expression dmd.expressionsem.semanticY(dmd.expression.DotTemplateInstanceExp, dmd.dscope.Scope*, int) [0x6eb26f]
src/dmd/expressionsem.d:6392 _ZN25ExpressionSemanticVisitor5visitEP22DotTemplateInstanceExp [0x6d1e74]
src/dmd/expression.d:4800 _ZN22DotTemplateInstanceExp6acceptEP7Visitor [0x6acbe4]
src/dmd/expressionsem.d:11477 dmd.expression.Expression dmd.expressionsem.unaSemantic(dmd.expression.UnaExp, dmd.dscope.Scope*) [0x6e872f]
src/dmd/expressionsem.d:6512 _ZN25ExpressionSemanticVisitor5visitEP7AddrExp [0x6d29d6]
src/dmd/expression.d:5041 _ZN7AddrExp6acceptEP7Visitor [0x6ad5c4]
src/dmd/expressionsem.d:11531 _ZN25ExpressionSemanticVisitor5visitEP9AssignExp [0x6db8df]
src/dmd/expression.d:5814 _ZN9AssignExp6acceptEP7Visitor [0x6aecf0]
src/dmd/statementsem.d:187 _ZN24StatementSemanticVisitor5visitEP12ExpStatement [0x7fbc9a]
src/dmd/statement.d:751 _ZN12ExpStatement6acceptEP7Visitor [0x7f73a0]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fc1c2]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f7d64]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7fd247]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f8128]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP13CaseStatement [0x80831c]
src/dmd/statement.d:1708 _ZN13CaseStatement6acceptEP7Visitor [0x7f96f0]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fc1c2]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f7d64]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7fd247]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f8128]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP21UnrolledLoopStatement [0x7fcd9d]
src/dmd/statement.d:1004 _ZN21UnrolledLoopStatement6acceptEP7Visitor [0x7f7ff4]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP16ForeachStatement [0x7feef6]
src/dmd/statement.d:1321 _ZN16ForeachStatement6acceptEP7Visitor [0x7f8a70]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fc1c2]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f7d64]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7fd247]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f8128]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP15SwitchStatement [0x80670b]
src/dmd/statement.d:1678 _ZN15SwitchStatement6acceptEP7Visitor [0x7f95ec]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14LabelStatement [0x80ec2f]
src/dmd/statement.d:2400 _ZN14LabelStatement6acceptEP7Visitor [0x7fad24]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fc1c2]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f7d64]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7fd247]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f8128]
src/dmd/statementsem.d:4353 _ZN24StatementSemanticVisitor5visitEP12ForStatement [0x7fe581]
src/dmd/statement.d:1267 _ZN12ForStatement6acceptEP7Visitor [0x7f8930]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fc1c2]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f7d64]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7fd247]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f8128]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP12ForStatement [0x7fde0f]
src/dmd/statement.d:1267 _ZN12ForStatement6acceptEP7Visitor [0x7f8930]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fc1c2]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f7d64]
src/dmd/semantic3.d:575 _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0x7f0217]
src/dmd/func.d:2569 _ZN15FuncDeclaration6acceptEP7Visitor [0x6f2f94]
src/dmd/semantic3.d:1438 _ZN16Semantic3Visitor5visitEP17AttribDeclaration [0x7f42b8]
src/dmd/parsetimevisitor.d:77 _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP23StorageClassDeclaration [0x7e7bd2]
src/dmd/attrib.d:324 _ZN23StorageClassDeclaration6acceptEP7Visitor [0x596f60]
src/dmd/semantic3.d:1464 _ZN16Semantic3Visitor5visitEP20AggregateDeclaration [0x7f453c]
src/dmd/parsetimevisitor.d:89 _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP16ClassDeclaration [0x7e7c65]
src/dmd/dclass.d:982 _ZN16ClassDeclaration6acceptEP7Visitor [0x5ea304]
src/dmd/semantic3.d:81 _ZN16Semantic3Visitor5visitEP16TemplateInstance [0x7edfa7]
src/dmd/dtemplate.d:7506 _ZN16TemplateInstance6acceptEP7Visitor [0x67e888]
src/dmd/dsymbolsem.d:6299 void dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) [0x6643e8]
src/dmd/dtemplate.d:3109 void dmd.dtemplate.functionResolve(ref dmd.declaration.MatchAccumulator, dmd.dsymbol.Dsymbol, dmd.globals.Loc, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, const(char)**) [0x6722ba]
src/dmd/func.d:2866 dmd.func.FuncDeclaration dmd.func.resolveFuncCall(ref const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.dsymbol.Dsymbol, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, dmd.func.FuncResolveFlag) [0x6f3fd7]
src/dmd/expressionsem.d:4859 _ZN25ExpressionSemanticVisitor5visitEP7CallExp [0x6c8b1e]
src/dmd/expression.d:4984 _ZN7CallExp6acceptEP7Visitor [0x6ad428]
src/dmd/initsem.d:644 dmd.init.Initializer dmd.initsem.inferType(dmd.init.Initializer, dmd.dscope.Scope*).visitExp(dmd.init.ExpInitializer) [0x744777]
src/dmd/initsem.d:702 dmd.init.Initializer dmd.initsem.inferType(dmd.init.Initializer, dmd.dscope.Scope*) [0x744296]
src/dmd/dsymbolsem.d:822 _ZN22DsymbolSemanticVisitor5visitEP14VarDeclaration [0x649598]
src/dmd/declaration.d:1650 _ZN14VarDeclaration6acceptEP7Visitor [0x5ed6a8]
src/dmd/expressionsem.d:5144 _ZN25ExpressionSemanticVisitor5visitEP14DeclarationExp [0x6cb2d9]
src/dmd/expression.d:3968 _ZN14DeclarationExp6acceptEP7Visitor [0x6aa960]
src/dmd/statementsem.d:187 _ZN24StatementSemanticVisitor5visitEP12ExpStatement [0x7fbc9a]
src/dmd/statement.d:751 _ZN12ExpStatement6acceptEP7Visitor [0x7f73a0]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fc1c2]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f7d64]
src/dmd/semantic3.d:575 _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0x7f0217]
src/dmd/func.d:2569 _ZN15FuncDeclaration6acceptEP7Visitor [0x6f2f94]
src/dmd/semantic3.d:194 _ZN16Semantic3Visitor5visitEP6Module [0x7ee902]
src/dmd/dmodule.d:1485 _ZN6Module6acceptEP7Visitor [0x61c780]
src/dmd/mars.d:578 int dmd.mars.tryMain(ulong, const(char)**, ref dmd.globals.Param) [0x78a3fc]
src/dmd/mars.d:956 _Dmain [0x78c024]

@schveiguy
Copy link
Copy Markdown
Member Author

For future reference, this was the code at the time: https://github.com/dlang/dmd/tree/4d2ee79c7c4d644875993600af88d340b030d437/src/dmd

@schveiguy
Copy link
Copy Markdown
Member Author

TypeFunction is a final class, so no virtual calls. It really does look like a GC issue.

@MoonlightSentinel
Copy link
Copy Markdown
Contributor

How about merging the memory handler s.t. we can use it for the CI? (now that we know the details of that crash).

If so, I would like to see some minor changes:

  • usable with -version=NoMain (required for the unit tests)
  • no output if the handler is registered successfully.

Maybe move the registration into a dedicated function-

@schveiguy
Copy link
Copy Markdown
Member Author

Yeah, ok. I still want to find the original crash. But I think this would require things like memory sentinels (which I'm sure don't work out of the box here). I'll create a separate PR.

@schveiguy
Copy link
Copy Markdown
Member Author

schveiguy commented Aug 30, 2020

Another Linux 32 failure happened. Completely different location Edit, not a completely different location, actually the same location:

etc.linux.memoryerror.InvalidPointerError@src/etc/linux/memoryerror.d(328)
----------------
??:? void etc.linux.memoryerror.sigsegvUserspaceProcess(void*) [0x98e6af]
??:? void etc.linux.memoryerror.sigsegvDataHandler() [0x98e596]
src/dmd/typesem.d:1564 dmd.mtype.Type dmd.typesem.typeSemantic(dmd.mtype.Type, ref const(dmd.globals.Loc), dmd.dscope.Scope*).visitFunction(dmd.mtype.TypeFunction) [0x82bced]
src/dmd/typesem.d:1972 _Z12typeSemanticP4TypeRK3LocP5Scope [0x828d4d]
src/dmd/dtemplate.d:1175 dmd.globals.MATCH dmd.dtemplate.TemplateDeclaration.matchWithInstance(dmd.dscope.Scope*, dmd.dtemplate.TemplateInstance, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.root.array.Array!(dmd.expression.Expression).Array*, int) [0x66ec65]
src/dmd/dtemplate.d:7179 int dmd.dtemplate.TemplateInstance.needsTypeInference(dmd.dscope.Scope*, int).__lambda3(dmd.dsymbol.Dsymbol) [0x67ec5c]
src/dmd/func.d:2707 int dmd.func.overloadApply(dmd.dsymbol.Dsymbol, int delegate(dmd.dsymbol.Dsymbol), dmd.dscope.Scope*) [0x6f45ee]
src/dmd/dtemplate.d:7095 bool dmd.dtemplate.TemplateInstance.needsTypeInference(dmd.dscope.Scope*, int) [0x67e7a3]
src/dmd/expressionsem.d:3254 _ZN25ExpressionSemanticVisitor5visitEP8ScopeExp [0x6c1ce8]
src/dmd/expression.d:3328 _ZN8ScopeExp6acceptEP7Visitor [0x6aa128]
src/dmd/expressionsem.d:12068 dmd.expression.Expression dmd.expressionsem.semanticY(dmd.expression.DotTemplateInstanceExp, dmd.dscope.Scope*, int) [0x6ec4bf]
src/dmd/expressionsem.d:6392 _ZN25ExpressionSemanticVisitor5visitEP22DotTemplateInstanceExp [0x6d30c4]
src/dmd/expression.d:4800 _ZN22DotTemplateInstanceExp6acceptEP7Visitor [0x6ade34]
src/dmd/expressionsem.d:11477 dmd.expression.Expression dmd.expressionsem.unaSemantic(dmd.expression.UnaExp, dmd.dscope.Scope*) [0x6e997f]
src/dmd/expressionsem.d:6512 _ZN25ExpressionSemanticVisitor5visitEP7AddrExp [0x6d3c26]
src/dmd/expression.d:5041 _ZN7AddrExp6acceptEP7Visitor [0x6ae814]
src/dmd/expressionsem.d:11531 _ZN25ExpressionSemanticVisitor5visitEP9AssignExp [0x6dcb2f]
src/dmd/expression.d:5814 _ZN9AssignExp6acceptEP7Visitor [0x6aff40]
src/dmd/statementsem.d:187 _ZN24StatementSemanticVisitor5visitEP12ExpStatement [0x7fdb4e]
src/dmd/statement.d:751 _ZN12ExpStatement6acceptEP7Visitor [0x7f9254]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fe076]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f9c18]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7ff0fb]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f9fdc]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP13CaseStatement [0x80a1d0]
src/dmd/statement.d:1708 _ZN13CaseStatement6acceptEP7Visitor [0x7fb5a4]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fe076]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f9c18]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7ff0fb]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f9fdc]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP21UnrolledLoopStatement [0x7fec51]
src/dmd/statement.d:1004 _ZN21UnrolledLoopStatement6acceptEP7Visitor [0x7f9ea8]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP16ForeachStatement [0x800daa]
src/dmd/statement.d:1321 _ZN16ForeachStatement6acceptEP7Visitor [0x7fa924]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fe076]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f9c18]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7ff0fb]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f9fdc]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP15SwitchStatement [0x8085bf]
src/dmd/statement.d:1678 _ZN15SwitchStatement6acceptEP7Visitor [0x7fb4a0]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14LabelStatement [0x810ae3]
src/dmd/statement.d:2400 _ZN14LabelStatement6acceptEP7Visitor [0x7fcbd8]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fe076]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f9c18]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7ff0fb]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f9fdc]
src/dmd/statementsem.d:4353 _ZN24StatementSemanticVisitor5visitEP12ForStatement [0x800435]
src/dmd/statement.d:1267 _ZN12ForStatement6acceptEP7Visitor [0x7fa7e4]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fe076]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f9c18]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement [0x7ff0fb]
src/dmd/statement.d:1046 _ZN14ScopeStatement6acceptEP7Visitor [0x7f9fdc]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP12ForStatement [0x7ffcc3]
src/dmd/statement.d:1267 _ZN12ForStatement6acceptEP7Visitor [0x7fa7e4]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fe076]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f9c18]
src/dmd/semantic3.d:575 _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0x7f20cb]
src/dmd/func.d:2569 _ZN15FuncDeclaration6acceptEP7Visitor [0x6f41e4]
src/dmd/semantic3.d:1438 _ZN16Semantic3Visitor5visitEP17AttribDeclaration [0x7f616c]
src/dmd/parsetimevisitor.d:77 _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP23StorageClassDeclaration [0x7e9a86]
src/dmd/attrib.d:324 _ZN23StorageClassDeclaration6acceptEP7Visitor [0x5987e4]
src/dmd/semantic3.d:1464 _ZN16Semantic3Visitor5visitEP20AggregateDeclaration [0x7f63f0]
src/dmd/parsetimevisitor.d:89 _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP16ClassDeclaration [0x7e9b19]
src/dmd/dclass.d:982 _ZN16ClassDeclaration6acceptEP7Visitor [0x5ebb88]
src/dmd/semantic3.d:81 _ZN16Semantic3Visitor5visitEP16TemplateInstance [0x7efe5b]
src/dmd/dtemplate.d:7488 _ZN16TemplateInstance6acceptEP7Visitor [0x67f67c]
src/dmd/dsymbolsem.d:6299 void dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) [0x665c79]
src/dmd/dtemplate.d:3091 void dmd.dtemplate.functionResolve(ref dmd.declaration.MatchAccumulator, dmd.dsymbol.Dsymbol, dmd.globals.Loc, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, const(char)**) [0x673096]
src/dmd/func.d:2866 dmd.func.FuncDeclaration dmd.func.resolveFuncCall(ref const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.dsymbol.Dsymbol, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, dmd.func.FuncResolveFlag) [0x6f5227]
src/dmd/expressionsem.d:4859 _ZN25ExpressionSemanticVisitor5visitEP7CallExp [0x6c9d6e]
src/dmd/expression.d:4984 _ZN7CallExp6acceptEP7Visitor [0x6ae678]
src/dmd/initsem.d:644 dmd.init.Initializer dmd.initsem.inferType(dmd.init.Initializer, dmd.dscope.Scope*).visitExp(dmd.init.ExpInitializer) [0x7459db]
src/dmd/initsem.d:702 dmd.init.Initializer dmd.initsem.inferType(dmd.init.Initializer, dmd.dscope.Scope*) [0x7454fa]
src/dmd/dsymbolsem.d:822 _ZN22DsymbolSemanticVisitor5visitEP14VarDeclaration [0x64ae1c]
src/dmd/declaration.d:1650 _ZN14VarDeclaration6acceptEP7Visitor [0x5eef2c]
src/dmd/expressionsem.d:5144 _ZN25ExpressionSemanticVisitor5visitEP14DeclarationExp [0x6cc529]
src/dmd/expression.d:3968 _ZN14DeclarationExp6acceptEP7Visitor [0x6abbb0]
src/dmd/statementsem.d:187 _ZN24StatementSemanticVisitor5visitEP12ExpStatement [0x7fdb4e]
src/dmd/statement.d:751 _ZN12ExpStatement6acceptEP7Visitor [0x7f9254]
src/dmd/statementsem.d:132 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement [0x7fe076]
src/dmd/statement.d:939 _ZN17CompoundStatement6acceptEP7Visitor [0x7f9c18]
src/dmd/semantic3.d:575 _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0x7f20cb]
src/dmd/func.d:2569 _ZN15FuncDeclaration6acceptEP7Visitor [0x6f41e4]
src/dmd/semantic3.d:194 _ZN16Semantic3Visitor5visitEP6Module [0x7f07b6]
src/dmd/dmodule.d:1485 _ZN6Module6acceptEP7Visitor [0x61e004]
src/dmd/mars.d:578 int dmd.mars.tryMain(ulong, const(char)**, ref dmd.globals.Param) [0x78c1dc]
src/dmd/mars.d:956 _Dmain [0x78de04]

@RazvanN7
Copy link
Copy Markdown
Contributor

@schveiguy What is the status of this PR? I see that #11646 was merged, so is this PR still needed?

@schveiguy
Copy link
Copy Markdown
Member Author

The point of this was to be able to get information from the only environment where DMD seems to crash -- the auto tester. This has been green for a while, and looking at the freebsd boxes (where the crash mostly happened), they have pretty good records at the moment. I'll close this, we can always do it again if it starts becoming an issue.

@schveiguy schveiguy closed this Jan 12, 2021
@RazvanN7
Copy link
Copy Markdown
Contributor

@schveiguy Thanks for the prompt response!

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.

7 participants