d-language-server / dls

A Language Server implementation for D
http://dls.dub.pm
106 stars 15 forks source link

DLS failing to start with RangeError #20

Open LaurentTreguier opened 5 years ago

LaurentTreguier commented 5 years ago

From https://github.com/d-language-server/dls/issues/7#issuecomment-450609239:

core.exception.RangeError@/Users/travis/dlang/ldc-1.13.0/bin/../import/std/utf.d(448): Range violation
----------------
??:? pure nothrow @nogc @safe int core.internal.string.numDigits!(10u).numDigits(ulong) [0x10de204f9]
??:? pure nothrow @nogc @safe uint rt.cover.max!(uint).max(uint, uint) [0x10de3b96a]
??:? pure nothrow @nogc @safe uint rt.cover.max!(uint).max(uint, uint) [0x10de3c65e]
??:? bool core.demangle.mangle!(int function(scope int delegate(immutable(object.ModuleInfo*)))).mangle(const(char)[], char[]).DotSplitter.__xopEquals(ref const(core.demangle.mangle!(int function(scope int delegate(immutable(object.ModuleInfo*)))).mangle(const(char)[], char[]).DotSplitter), ref const(core.demangle.mangle!(int function(scope int delegate(immutable(object.ModuleInfo*)))).mangle(const(char)[], char[]).DotSplitter)) [0x10de1b671]
??:? pure nothrow @nogc core.exception.InvalidMemoryOperationError core.exception.staticError!(core.exception.InvalidMemoryOperationError).staticError() [0x10de1bf27]
??:? pure @safe ulong std.utf.toUCSindex!(wchar).toUCSindex(const(wchar)[], ulong) [0x10d9afd65]
??:? pure @nogc @safe ulong std.algorithm.iteration.reduce!(dls.util.document.Document.byteAtPosition(const(dls.protocol.definitions.Position)).__lambda2).reduce!(ulong, std.range.iota!(const(ulong), const(ulong)).iota(const(ulong), const(ulong)).Result).reduce(ulong, std.range.iota!(const(ulong), const(ulong)).iota(const(ulong), const(ulong)).Result) [0x10d9a72ed]
??:? void inifiled.readINIFile!(dscanner.analysis.config.StaticAnalysisConfig).readINIFile(ref dscanner.analysis.config.StaticAnalysisConfig, immutable(char)[]) [0x10d89fab0]
??:? std.typecons.Flag!("each").Flag std.algorithm.iteration.each!(dls.tools.analysis_tool.AnalysisTool.scanAllWorkspaces().__lambda1).each!(dls.util.uri.Uri[]).each(dls.util.uri.Uri[]) [0x10d89ef32]
??:? void dls.protocol.handlers.pushHandler!(void function(std.json.JSONValue)*).pushHandler(const(immutable(char)[]), void function(std.json.JSONValue)*) [0x10d8b7039]
??:? void dls.protocol.handlers.pushHandler!(void function(std.json.JSONValue)*).pushHandler(const(immutable(char)[]), void function(std.json.JSONValue)*).__lambda3(std.typecons.Nullable!(std.json.JSONValue).Nullable) [0x10d913f60]
??:? pure nothrow @safe void std.container.dlist.DList!(dls.util.disposable_fiber.DisposableFiber).DList.removeFront() [0x10d8bc65c]
??:? pure @safe ulong std.conv.to!(ulong).to!(immutable(char)[]).to(immutable(char)[]) [0x10d8bbd1f]
??:? nothrow void core.thread.thread_scanAll(scope void delegate(void*, void*) nothrow).__lambda2!(core.thread.ScanType, void*, void*).__lambda2(core.thread.ScanType, void*, void*) [0x10de24913]
[Info  - 1:17:43 PM] Connection to server got closed. Server will restart.
LaurentTreguier commented 5 years ago

@patrickkh7788 I have added a d.init.safeMode option that you can enable in VSCode. It disables processing multiple requests at the same time. I will add debugging info in DLS to see file names and lines in errors.

LaurentTreguier commented 5 years ago

Actually, I have an idea: some programs crash in release mode when using dmd -inline. Maybe disabling inlining could solve the problem.

LaurentTreguier commented 5 years ago

Starting from v0.21.2, DLS is compiled without inlining and without executable compression. Maybe one of those can solve the problem.

LaurentTreguier commented 5 years ago

This looks like #25, and could perhaps be fixed by 656926b4ddd2ae2b521293f36088cc73742dfbb1