huntlabs / hunt

A refined core library for D programming language. The module has concurrency / collections / event / io / logging / text / serialization and more.
Apache License 2.0
95 stars 15 forks source link

Not Compiling with Profiling #88

Open JonathanILevi opened 3 years ago

JonathanILevi commented 3 years ago

When compiling Hunt v1.7.7 in my project with profiling enabled, hunt causes a statement is not reachable warning in std.concurrency.

When I suppress that warning I get a runtime assert error in hunt-extra/source/hunt/collection/Radix.d:294, thrown by std.bitmanip.

I am running Linux (NixOS), Dub verison 1.23.0, and Dmd version 2.095.1.

hunt 1.7.7: building configuration "library"...
/nix/store/ym357ill7dxqiclr2q4qk4h5avqgi5zz-dmd-2.095.1/include/dmd/std/concurrency.d(2097,17): Warning: statement is not reachable
hunt-extra 1.1.3: building configuration "library"...
/home/jonathan/.dub/packages/hunt-extra-1.1.3/hunt-extra/source/hunt/collection/Radix.d(49,28): Deprecation: returning cast(char*)(&this + 8L) escapes a reference to parameter this
/home/jonathan/.dub/packages/hunt-extra-1.1.3/hunt-extra/source/hunt/collection/Radix.d(49,28):        perhaps annotate the parameter with return
hunt-net 0.6.6: building configuration "default"...
hunt-http 0.7.3: building configuration "default"...
sigma_tau:terminal_networking ~master: building configuration "library"...
srcs/terminal_networking/networking_/terminal_networking_.d(33,67): Deprecation: alias hunt.io.ByteBuffer.ByteBuffer.getRemaining is deprecated - Using peekRemaining instead.
sigma_tau ~master: building configuration "application"...
Running pre-build commands...
Warning: statement is not reachable
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running ./sigma_tau 
core.exception.AssertError@/nix/store/ym357ill7dxqiclr2q4qk4h5avqgi5zz-dmd-2.095.1/include/dmd/std/bitmanip.d(1155): i must be less than the length
----------------
??:? _d_assert_msg [0x1328f3a]
/home/jonathan/.dub/packages/hunt-1.7.7/hunt/source/hunt/event/selector/Epoll.d:294 core.sys.linux.epoll.epoll_event hunt.event.selector.Epoll.AbstractSelector.buildEpollEvent(hunt.io.channel.AbstractChannel.AbstractChannel, ref core.sys.linux.epoll.epoll_event) [0x12bea07]
/home/jonathan/.dub/packages/hunt-1.7.7/hunt/source/hunt/event/selector/Epoll.d:308 bool hunt.event.selector.Epoll.AbstractSelector.epollCtl(hunt.io.channel.AbstractChannel.AbstractChannel, int) [0x12beb27]
/home/jonathan/.dub/packages/hunt-1.7.7/hunt/source/hunt/event/selector/Epoll.d:129 bool hunt.event.selector.Epoll.AbstractSelector.register(hunt.io.channel.AbstractChannel.AbstractChannel) [0x12be20e]
/home/jonathan/.dub/packages/hunt-1.7.7/hunt/source/hunt/event/selector/Epoll.d:78 hunt.event.selector.Epoll.AbstractSelector hunt.event.selector.Epoll.AbstractSelector.__ctor(ulong, ulong, hunt.util.worker.Worker.Worker, ulong) [0x12be047]
/home/jonathan/.dub/packages/hunt-1.7.7/hunt/source/hunt/event/EventLoop.d:41 hunt.event.EventLoop.EventLoop hunt.event.EventLoop.EventLoop.__ctor(ulong, ulong, hunt.util.worker.Worker.Worker) [0x12bc52d]
/home/jonathan/.dub/packages/hunt-1.7.7/hunt/source/hunt/event/EventLoopGroup.d:43 hunt.event.EventLoopGroup.EventLoopGroup hunt.event.EventLoopGroup.EventLoopGroup.__ctor(ulong, ulong) [0x12bd914]
/home/jonathan/.dub/packages/hunt-net-0.6.6/hunt-net/source/hunt/net/NetServerImpl.d:56 hunt.net.NetServerImpl.NetServerImpl!(0).NetServerImpl hunt.net.NetServerImpl.NetServerImpl!(0).NetServerImpl.__ctor(hunt.net.NetServerOptions.NetServerOptions) [0x100263f]
/home/jonathan/.dub/packages/hunt-http-0.7.3/hunt-http/source/hunt/http/server/HttpServer.d:140 hunt.http.server.HttpServer.HttpServer hunt.http.server.HttpServer.HttpServer.__ctor(hunt.http.server.HttpServerOptions.HttpServerOptions, hunt.http.server.ServerSessionListener.ServerSessionListener, hunt.http.server.ServerHttpHandler.ServerHttpHandler, hunt.http.server.WebSocketHandler.WebSocketHandler) [0xfd6d10]
/home/jonathan/.dub/packages/hunt-http-0.7.3/hunt-http/source/hunt/http/server/HttpServer.d:87 hunt.http.server.HttpServer.HttpServer hunt.http.server.HttpServer.HttpServer.__ctor(hunt.http.server.HttpServerOptions.HttpServerOptions, hunt.http.server.ServerHttpHandler.ServerHttpHandler, hunt.http.server.WebSocketHandler.WebSocketHandler) [0xfd685d]
srcs/terminal_networking/networking_/terminal_networking_.d:36 networking_.terminal_networking_.TerminalServer networking_.terminal_networking_.TerminalServer.__ctor(ushort) [0xaf6177]
srcs/src/player_ship_.d:72 void player_ship_.PlayerShip.run() [0xa60177]
??:? void core.thread.context.Callable.opCall() [0x13369c0]
??:? fiber_entryPoint [0x1378983]
Program exited with code 1
Heromyth commented 3 years ago

It seems working to add

"dflags": ["-profile", "-profile=gc"],

to dub.json. Not sure what happed for this.

JonathanILevi commented 3 years ago

I was using dub run build=profile, not sure why it is different.

Heromyth commented 3 years ago

See https://github.com/dlang/dub/issues/2130.