HyperFastCgi
HyperFastCgi copied to clipboard
segfault after interrupting hung process with /stoppable=true
In the course of debugging, I was running HFC with /stoppable=True. Hitting enter would shutdown the service, but would hang in the terminal. Hitting ctl-c causes this:
libev.c:432: Shutdown(): Goodbye.
Stacktrace:
Native stacktrace:
mono() [0x4accca]
mono() [0x5040fe]
mono() [0x4275d7]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0) [0x7f3b55cc10a0]
/lib/x86_64-linux-gnu/libpthread.so.0(pthread_mutex_lock+0x4) [0x7f3b55cbb194]
/usr/lib/x86_64-linux-gnu/libevent-2.0.so.5(+0x255ee) [0x7f3b5160f5ee]
/usr/lib/x86_64-linux-gnu/libevent-2.0.so.5(event_base_loop+0x120) [0x7f3b515faf60]
/usr/lib/libhfc-native.so.1(ProcessLoop+0xd) [0x7f3b51d3245d]
[0x4032aeaa]
Debug info from gdb:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Aborted
Command line: mono --debug /usr/local/src/HyperFastCgi/src/HyperFastCgi/4.0/bin/Release/HyperFastCgi.exe /config=/etc/nginx/hyper.config /stoppable=True /printlog=True /loglevels=All
Can you provide a reproducible case (application and configs), so I can look what is wrong?
Reflect.cs (it's a bad name, has nothing to do with reflection)
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Newtonsoft.Json;
using HyperFastCgi;
using HyperFastCgi.AppHosts.Raw;
using HyperFastCgi.Interfaces;
namespace Reflect {
public class PeekRequest : BaseRawRequest {
public override void Process(IWebResponse response) {
string json;
if (ServerVariables == null || ServerVariables.Count == 0) {
json = "null";
} else {
json = JsonConvert.SerializeObject(ServerVariables,Formatting.Indented);
}
Status = 200;
StatusDescription = "OK";
ResponseHeaders.Add("Content-Type","application/json");
response.Send(Encoding.UTF8.GetBytes(json));
response.CompleteResponse();
}
}
}
And hyper.config:
<!-- vim: set ft=xml: -->
<configuration>
<server type="HyperFastCgi.ApplicationServers.SimpleApplicationServer">
<host-factory>HyperFastCgi.HostFactories.SystemWebHostFactory</host-factory>
<threads min-worker="40" max-worker="0" min-io="4" max-io="0"/>
<root-dir>/opt/hyper</root-dir>
</server>
<listener type="HyperFastCgi.Listeners.NativeListener">
<apphost-transport type="HyperFastCgi.Transports.NativeTransport">
<multithreading>ThreadPool</multithreading>
</apphost-transport>
<protocol>Unix</protocol>
<address>/var/tmp/hyper.sock</address>
</listener>
<apphost type="HyperFastCgi.AppHosts.Raw.RawHost">
<log level="All" write-to-console="true" />
<add-trailing-slash>false</add-trailing-slash>
<request-type>Reflect.PeekRequest,Reflect</request-type>
</apphost>
</configuration>
Mono: Mono JIT compiler version 4.6.2 (Stable 4.6.2.7/08fd525 Mon Nov 14 12:30:00 UTC 2016) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: sgen
Machine: Linux vm1 3.2.0-4-amd64 #1 SMP Debian 3.2.82-1 x86_64 GNU/Linux (7 / Wheezy)