fdtrack: temporary hack for tracking file descriptor usage

Package fdtrack logs statistics about open file descriptors.
This should help identify the source of #1549.
This commit is contained in:
Felix Lange
2015-08-03 02:45:33 +02:00
parent bf48ed32dd
commit 5c949d3b3b
15 changed files with 314 additions and 7 deletions

View File

@ -22,6 +22,7 @@ import (
"net"
"os"
"github.com/ethereum/go-ethereum/fdtrack"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rpc/codec"
@ -50,15 +51,16 @@ func (self *ipcClient) reconnect() error {
func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error {
os.Remove(cfg.Endpoint) // in case it still exists from a previous run
l, err := net.ListenUnix("unix", &net.UnixAddr{Name: cfg.Endpoint, Net: "unix"})
l, err := net.Listen("unix", cfg.Endpoint)
if err != nil {
return err
}
l = fdtrack.WrapListener("ipc", l)
os.Chmod(cfg.Endpoint, 0600)
go func() {
for {
conn, err := l.AcceptUnix()
conn, err := l.Accept()
if err != nil {
glog.V(logger.Error).Infof("Error accepting ipc connection - %v\n", err)
continue