Open lxh-015 opened 1 year ago
我在arm 32 的路由器上部署了chfs,正常启动,剩余可用内存不足100M,小文件可以上传,当上传大文件(300M)时出现内存溢出,日志如下,需要怎么处理
fatal error: runtime: out of memory runtime stack: runtime.throw(0x54b47e, 0x16) c:/go/src/runtime/panic.go:774 +0x5c runtime.sysMap(0x6400000, 0x4000000, 0x9a3e60) c:/go/src/runtime/mem_linux.go:169 +0xa8 runtime.(*linearAlloc).alloc(0x9978a8, 0x4000000, 0x400000, 0x9a3e60, 0x0) c:/go/src/runtime/malloc.go:1387 +0x94 runtime.(*mheap).sysAlloc(0x9975b0, 0x4000000, 0x0, 0x0) c:/go/src/runtime/malloc.go:607 +0x54 runtime.(*mheap).grow(0x9975b0, 0x2000, 0xffffffff) c:/go/src/runtime/mheap.go:1255 +0x84 runtime.(*mheap).allocSpanLocked(0x9975b0, 0x2000, 0x9a3e70, 0x1) c:/go/src/runtime/mheap.go:1170 +0x264 runtime.(*mheap).alloc_m(0x9975b0, 0x2000, 0x101, 0x0) c:/go/src/runtime/mheap.go:1022 +0xd0 runtime.(*mheap).alloc.func1() c:/go/src/runtime/mheap.go:1093 +0x3c runtime.(*mheap).alloc(0x9975b0, 0x2000, 0x10101, 0x21fc000) c:/go/src/runtime/mheap.go:1092 +0x60 runtime.largeAlloc(0x3fffe00, 0x101, 0x21fc2a0) c:/go/src/runtime/malloc.go:1138 +0x74 runtime.mallocgc.func1() c:/go/src/runtime/malloc.go:1033 +0x38 runtime.systemstack(0x2226000) c:/go/src/runtime/asm_arm.s:354 +0x84 runtime.mstart() c:/go/src/runtime/proc.go:1146 goroutine 17 [running]: runtime.systemstack_switch() c:/go/src/runtime/asm_arm.s:298 +0x4 fp=0x2069a2c sp=0x2069a28 pc=0x6c014 runtime.mallocgc(0x3fffe00, 0x4c3580, 0x401, 0x0) c:/go/src/runtime/malloc.go:1032 +0x8d0 fp=0x2069a94 sp=0x2069a2c pc=0x1b708 runtime.makeslice(0x4c3580, 0x3fffe00, 0x3fffe00, 0x21fa450) c:/go/src/runtime/slice.go:49 +0x6c fp=0x2069aa8 sp=0x2069a94 pc=0x55de0 bytes.makeSlice(0x3fffe00, 0x0, 0x0, 0x0) c:/go/src/bytes/buffer.go:229 +0x60 fp=0x2069adc sp=0x2069aa8 pc=0x10143c bytes.(*Buffer).grow(0x20bd0a0, 0x200, 0x5d3) c:/go/src/bytes/buffer.go:142 +0x138 fp=0x2069b00 sp=0x2069adc pc=0x100dd4 bytes.(*Buffer).ReadFrom(0x20bd0a0, 0x5ff550, 0x220c2d0, 0xa6ca9178, 0x20bd0a0, 0x1, 0x18) c:/go/src/bytes/buffer.go:202 +0x48 fp=0x2069b3c sp=0x2069b00 pc=0x101238 io.copyBuffer(0x5fef50, 0x20bd0a0, 0x5ff550, 0x220c2d0, 0x0, 0x0, 0x0, 0x30, 0x501f78, 0x2017701, ...) c:/go/src/io/io.go:388 +0x2fc fp=0x2069b7c sp=0x2069b3c pc=0xafcd0 io.Copy(...) c:/go/src/io/io.go:364 io.CopyN(0x5fef50, 0x20bd0a0, 0x5ff5f8, 0x204a500, 0x2000001, 0x0, 0x1, 0x204a4c0, 0x2ebd1c, 0x50e458) c:/go/src/io/io.go:340 +0x84 fp=0x2069bac sp=0x2069b7c pc=0xaf83c mime/multipart.(*Reader).readForm(0x204a4c0, 0x2000000, 0x0, 0x0, 0x0, 0x0) c:/go/src/mime/multipart/formdata.go:80 +0x4f8 fp=0x2069c94 sp=0x2069bac pc=0x295c60 mime/multipart.(*Reader).ReadForm(...) c:/go/src/mime/multipart/formdata.go:31 net/http.(*Request).ParseMultipartForm(0x2078980, 0x2000000, 0x0, 0x2, 0x220c220) c:/go/src/net/http/request.go:1298 +0x80 fp=0x2069d10 sp=0x2069c94 pc=0x2ef78c net/http.(*Request).FormValue(0x2078980, 0x540628, 0x6, 0x1, 0x0) c:/go/src/net/http/request.go:1326 +0x98 fp=0x2069d28 sp=0x2069d10 pc=0x2efc34 main.(*filterRouter).ServeHTTP(0x200f2a8, 0x6037c0, 0x2017320, 0x2078980) D:/projects/private/chfs/src/chfs/main.go:357 +0x950 fp=0x2069d9c sp=0x2069d28 pc=0x465730 net/http.serverHandler.ServeHTTP(0x2017e60, 0x6037c0, 0x2017320, 0x2078980) c:/go/src/net/http/server.go:2802 +0x88 fp=0x2069db8 sp=0x2069d9c pc=0x2fbbfc net/http.(*conn).serve(0x21f8000, 0x604420, 0x21f4080) c:/go/src/net/http/server.go:1890 +0x7e0 fp=0x2069fdc sp=0x2069db8 pc=0x2f8184 runtime.goexit() c:/go/src/runtime/asm_arm.s:868 +0x4 fp=0x2069fdc sp=0x2069fdc pc=0x6dd4c created by net/http.(*Server).Serve c:/go/src/net/http/server.go:2927 +0x2f0 goroutine 1 [IO wait]: internal/poll.runtime_pollWait(0xa6ca9070, 0x72, 0x0) c:/go/src/runtime/netpoll.go:184 +0x44 internal/poll.(*pollDesc).wait(0x2062604, 0x72, 0x0, 0x0, 0x54142b) c:/go/src/internal/poll/fd_poll_runtime.go:87 +0x30 internal/poll.(*pollDesc).waitRead(...) c:/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Accept(0x20625f0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) c:/go/src/internal/poll/fd_unix.go:384 +0x1a8 net.(*netFD).accept(0x20625f0, 0x9a2f68, 0x0, 0x1) c:/go/src/net/fd_unix.go:238 +0x20 net.(*TCPListener).accept(0x200d010, 0x21f82e0, 0x6eb69b00, 0x49068) c:/go/src/net/tcpsock_posix.go:139 +0x20 net.(*TCPListener).Accept(0x200d010, 0x2068e28, 0xc, 0x20000e0, 0x2fc064) c:/go/src/net/tcpsock.go:261 +0x3c net/http.(*Server).Serve(0x2017e60, 0x603660, 0x200d010, 0x0, 0x0) c:/go/src/net/http/server.go:2896 +0x220 main.main() D:/projects/private/chfs/src/chfs/main.go:189 +0xdc0 goroutine 6 [sync.Cond.Wait]: runtime.goparkunlock(...) c:/go/src/runtime/proc.go:310 sync.runtime_notifyListWait(0x200b1a8, 0x0) c:/go/src/runtime/sema.go:510 +0x150 sync.(*Cond).Wait(0x200b1a0) c:/go/src/sync/cond.go:56 +0x6c github.com/cihub/seelog.(*asyncLoopLogger).processItem(0x20729c0, 0x2000000) D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x84 github.com/cihub/seelog.(*asyncLoopLogger).processQueue(0x20729c0) D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x38 created by github.com/cihub/seelog.NewAsyncLoopLogger D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x6c goroutine 7 [sync.Cond.Wait]: runtime.goparkunlock(...) c:/go/src/runtime/proc.go:310 sync.runtime_notifyListWait(0x200b348, 0x0) c:/go/src/runtime/sema.go:510 +0x150 sync.(*Cond).Wait(0x200b340) c:/go/src/sync/cond.go:56 +0x6c github.com/cihub/seelog.(*asyncLoopLogger).processItem(0x2072a80, 0x0) D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x84 github.com/cihub/seelog.(*asyncLoopLogger).processQueue(0x2072a80) D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x38 created by github.com/cihub/seelog.NewAsyncLoopLogger D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x6c goroutine 8 [sync.Cond.Wait]: runtime.goparkunlock(...) c:/go/src/runtime/proc.go:310 sync.runtime_notifyListWait(0x20bcf88, 0x0) c:/go/src/runtime/sema.go:510 +0x150 sync.(*Cond).Wait(0x20bcf80) c:/go/src/sync/cond.go:56 +0x6c github.com/cihub/seelog.(*asyncLoopLogger).processItem(0x2073680, 0x0) D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:50 +0x84 github.com/cihub/seelog.(*asyncLoopLogger).processQueue(0x2073680) D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:63 +0x38 created by github.com/cihub/seelog.NewAsyncLoopLogger D:/projects/private/chfs/src/github.com/cihub/seelog/behavior_asynclooplogger.go:40 +0x6c goroutine 9 [sleep]: runtime.goparkunlock(...) c:/go/src/runtime/proc.go:310 time.Sleep(0x85c50000, 0x1a31) c:/go/src/runtime/time.go:105 +0x158 main.main.func1() D:/projects/private/chfs/src/chfs/main.go:118 +0x28 created by main.main D:/projects/private/chfs/src/chfs/main.go:114 +0x76c goroutine 10 [sleep]: runtime.goparkunlock(...) c:/go/src/runtime/proc.go:310 time.Sleep(0xb2c97000, 0x8b) c:/go/src/runtime/time.go:105 +0x158 chfs/preview.PreviewGeneratorDeamon(0x200eee0, 0x1, 0x1) D:/projects/private/chfs/src/chfs/preview/preview.go:29 +0x60 created by main.main D:/projects/private/chfs/src/chfs/main.go:124 +0x133c goroutine 27 [IO wait]: internal/poll.runtime_pollWait(0xa6ca8ddc, 0x72, 0xffffffff) c:/go/src/runtime/netpoll.go:184 +0x44 internal/poll.(*pollDesc).wait(0x21f2514, 0x72, 0x1000, 0x1000, 0xffffffff) c:/go/src/internal/poll/fd_poll_runtime.go:87 +0x30 internal/poll.(*pollDesc).waitRead(...) c:/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Read(0x21f2500, 0x233c000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/internal/poll/fd_unix.go:169 +0x178 net.(*netFD).Read(0x21f2500, 0x233c000, 0x1000, 0x1000, 0x394f01, 0x0, 0x2f30ec) c:/go/src/net/fd_unix.go:202 +0x38 net.(*conn).Read(0x21f6a28, 0x233c000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/net/net.go:184 +0x58 net/http.(*connReader).Read(0x21f5ce0, 0x233c000, 0x1000, 0x1000, 0x1, 0x0, 0x8) c:/go/src/net/http/server.go:785 +0x15c bufio.(*Reader).fill(0x21fa4e0) c:/go/src/bufio/bufio.go:100 +0x108 bufio.(*Reader).ReadSlice(0x21fa4e0, 0x529d0a, 0x1, 0xd0412, 0x21f2500, 0x0, 0x80) c:/go/src/bufio/bufio.go:359 +0x2c bufio.(*Reader).ReadLine(0x21fa4e0, 0x2342c10, 0x992798, 0xb6f2436c, 0x0, 0x2208280, 0x1) c:/go/src/bufio/bufio.go:388 +0x24 net/textproto.(*Reader).readLineSlice(0x21f5d20, 0x2216980, 0x2342e58, 0x21f2500, 0x60368, 0xc7718) c:/go/src/net/textproto/reader.go:57 +0x54 net/textproto.(*Reader).ReadLine(...) c:/go/src/net/textproto/reader.go:38 net/http.readRequest(0x21fa4e0, 0x0, 0x2216980, 0x0, 0x0) c:/go/src/net/http/request.go:1012 +0x5c net/http.(*conn).readRequest(0x21f8240, 0x604420, 0x21f5cc0, 0x0, 0x0, 0x0) c:/go/src/net/http/server.go:965 +0x1c8 net/http.(*conn).serve(0x21f8240, 0x604420, 0x21f5cc0) c:/go/src/net/http/server.go:1817 +0x644 created by net/http.(*Server).Serve c:/go/src/net/http/server.go:2927 +0x2f0 goroutine 44 [IO wait]: internal/poll.runtime_pollWait(0xa6ca8c50, 0x72, 0xffffffff) c:/go/src/runtime/netpoll.go:184 +0x44 internal/poll.(*pollDesc).wait(0x21f2424, 0x72, 0x1000, 0x1000, 0xffffffff) c:/go/src/internal/poll/fd_poll_runtime.go:87 +0x30 internal/poll.(*pollDesc).waitRead(...) c:/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Read(0x21f2410, 0x210c000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/internal/poll/fd_unix.go:169 +0x178 net.(*netFD).Read(0x21f2410, 0x210c000, 0x1000, 0x1000, 0x2202d48, 0x6b054, 0x21be000) c:/go/src/net/fd_unix.go:202 +0x38 net.(*conn).Read(0x200f040, 0x210c000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/net/net.go:184 +0x58 net/http.(*persistConn).Read(0x20c6000, 0x210c000, 0x1000, 0x1000, 0x2020840, 0x30f340, 0x2020840) c:/go/src/net/http/transport.go:1752 +0x164 bufio.(*Reader).fill(0x21fa360) c:/go/src/bufio/bufio.go:100 +0x108 bufio.(*Reader).Peek(0x21fa360, 0x1, 0x0, 0x0, 0x1, 0x2020700, 0x0) c:/go/src/bufio/bufio.go:138 +0x38 net/http.(*persistConn).readLoop(0x20c6000) c:/go/src/net/http/transport.go:1905 +0x178 created by net/http.(*Transport).dialConn c:/go/src/net/http/transport.go:1574 +0x8e8 goroutine 21 [IO wait]: internal/poll.runtime_pollWait(0xa6ca8f68, 0x72, 0xffffffff) c:/go/src/runtime/netpoll.go:184 +0x44 internal/poll.(*pollDesc).wait(0x21f2294, 0x72, 0x1000, 0x1000, 0xffffffff) c:/go/src/internal/poll/fd_poll_runtime.go:87 +0x30 internal/poll.(*pollDesc).waitRead(...) c:/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Read(0x21f2280, 0x22dc000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/internal/poll/fd_unix.go:169 +0x178 net.(*netFD).Read(0x21f2280, 0x22dc000, 0x1000, 0x1000, 0x394f01, 0x0, 0x2f30ec) c:/go/src/net/fd_unix.go:202 +0x38 net.(*conn).Read(0x21f6950, 0x22dc000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/net/net.go:184 +0x58 net/http.(*connReader).Read(0x21f55a0, 0x22dc000, 0x1000, 0x1000, 0x1, 0x0, 0x8) c:/go/src/net/http/server.go:785 +0x15c bufio.(*Reader).fill(0x21fa300) c:/go/src/bufio/bufio.go:100 +0x108 bufio.(*Reader).ReadSlice(0x21fa300, 0x529d0a, 0x1, 0xd0412, 0x21f2200, 0x0, 0x80) c:/go/src/bufio/bufio.go:359 +0x2c bufio.(*Reader).ReadLine(0x21fa300, 0x2065c10, 0x2226000, 0xb6f2436c, 0x0, 0x2208280, 0x1) c:/go/src/bufio/bufio.go:388 +0x24 net/textproto.(*Reader).readLineSlice(0x21f55e0, 0x2216900, 0x2065e58, 0x21f2280, 0x60368, 0xc7718) c:/go/src/net/textproto/reader.go:57 +0x54 net/textproto.(*Reader).ReadLine(...) c:/go/src/net/textproto/reader.go:38 net/http.readRequest(0x21fa300, 0x0, 0x2216900, 0x0, 0x0) c:/go/src/net/http/request.go:1012 +0x5c net/http.(*conn).readRequest(0x21f80c0, 0x604420, 0x21f5580, 0x0, 0x0, 0x0) c:/go/src/net/http/server.go:965 +0x1c8 net/http.(*conn).serve(0x21f80c0, 0x604420, 0x21f5580) c:/go/src/net/http/server.go:1817 +0x644 created by net/http.(*Server).Serve c:/go/src/net/http/server.go:2927 +0x2f0 goroutine 22 [IO wait]: internal/poll.runtime_pollWait(0xa6ca8ee4, 0x72, 0xffffffff) c:/go/src/runtime/netpoll.go:184 +0x44 internal/poll.(*pollDesc).wait(0x21f22e4, 0x72, 0x1000, 0x1000, 0xffffffff) c:/go/src/internal/poll/fd_poll_runtime.go:87 +0x30 internal/poll.(*pollDesc).waitRead(...) c:/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Read(0x21f22d0, 0x22ee000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/internal/poll/fd_unix.go:169 +0x178 net.(*netFD).Read(0x21f22d0, 0x22ee000, 0x1000, 0x1000, 0x394f01, 0x0, 0x2f30ec) c:/go/src/net/fd_unix.go:202 +0x38 net.(*conn).Read(0x21f6958, 0x22ee000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/net/net.go:184 +0x58 net/http.(*connReader).Read(0x21f57e0, 0x22ee000, 0x1000, 0x1000, 0x1, 0x0, 0x8) c:/go/src/net/http/server.go:785 +0x15c bufio.(*Reader).fill(0x21fa390) c:/go/src/bufio/bufio.go:100 +0x108 bufio.(*Reader).ReadSlice(0x21fa390, 0x529d0a, 0x1, 0xd0412, 0x21f2200, 0x0, 0x80) c:/go/src/bufio/bufio.go:359 +0x2c bufio.(*Reader).ReadLine(0x21fa390, 0x2233c10, 0x2226000, 0xb6f2436c, 0x0, 0x20b8280, 0x1) c:/go/src/bufio/bufio.go:388 +0x24 net/textproto.(*Reader).readLineSlice(0x200a100, 0x2174080, 0x2233e58, 0x21f22d0, 0x60368, 0xc7718) c:/go/src/net/textproto/reader.go:57 +0x54 net/textproto.(*Reader).ReadLine(...) c:/go/src/net/textproto/reader.go:38 net/http.readRequest(0x21fa390, 0x0, 0x2174080, 0x0, 0x0) c:/go/src/net/http/request.go:1012 +0x5c net/http.(*conn).readRequest(0x21f8120, 0x604420, 0x21f57c0, 0x0, 0x0, 0x0) c:/go/src/net/http/server.go:965 +0x1c8 net/http.(*conn).serve(0x21f8120, 0x604420, 0x21f57c0) c:/go/src/net/http/server.go:1817 +0x644 created by net/http.(*Server).Serve c:/go/src/net/http/server.go:2927 +0x2f0 goroutine 23 [IO wait]: internal/poll.runtime_pollWait(0xa6ca8e60, 0x72, 0xffffffff) c:/go/src/runtime/netpoll.go:184 +0x44 internal/poll.(*pollDesc).wait(0x21f2334, 0x72, 0x1000, 0x1000, 0xffffffff) c:/go/src/internal/poll/fd_poll_runtime.go:87 +0x30 internal/poll.(*pollDesc).waitRead(...) c:/go/src/internal/poll/fd_poll_runtime.go:92 internal/poll.(*FD).Read(0x21f2320, 0x22da000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/internal/poll/fd_unix.go:169 +0x178 net.(*netFD).Read(0x21f2320, 0x22da000, 0x1000, 0x1000, 0x394f01, 0x0, 0x2f30ec) c:/go/src/net/fd_unix.go:202 +0x38 net.(*conn).Read(0x21f6960, 0x22da000, 0x1000, 0x1000, 0x0, 0x0, 0x0) c:/go/src/net/net.go:184 +0x58 net/http.(*connReader).Read(0x21f5500, 0x22da000, 0x1000, 0x1000, 0x1, 0x0, 0x8) c:/go/src/net/http/server.go:785 +0x15c bufio.(*Reader).fill(0x21fa2d0) c:/go/src/bufio/bufio.go:100 +0x108 bufio.(*Reader).ReadSlice(0x21fa2d0, 0x529d0a, 0x1, 0xd0412, 0x21f2300, 0x0, 0x80) c:/go/src/bufio/bufio.go:359 +0x2c bufio.(*Reader).ReadLine(0x21fa2d0, 0x2064c10, 0x992798, 0xb6f24008, 0x0, 0x2208200, 0x0) c:/go/src/bufio/bufio.go:388 +0x24 net/textproto.(*Reader).readLineSlice(0x21f4100, 0x2174a00, 0x2064e58, 0x21f2320, 0x60368, 0xc7718) c:/go/src/net/textproto/reader.go:57 +0x54 net/textproto.(*Reader).ReadLine(...) c:/go/src/net/textproto/reader.go:38 net/http.readRequest(0x21fa2d0, 0x0, 0x2174a00, 0x0, 0x0) c:/go/src/net/http/request.go:1012 +0x5c net/http.(*conn).readRequest(0x21f8180, 0x604420, 0x21f54e0, 0x0, 0x0, 0x0) c:/go/src/net/http/server.go:965 +0x1c8 net/http.(*conn).serve(0x21f8180, 0x604420, 0x21f54e0) c:/go/src/net/http/server.go:1817 +0x644 created by net/http.(*Server).Serve c:/go/src/net/http/server.go:2927 +0x2f0 goroutine 28 [IO wait]: internal/poll.runtime_pollWait(0xa6ca8d58, 0x72, 0xffffffff) c:/go/src/runtime/netpoll.go:184 +0x44
我在arm 32 的路由器上部署了chfs,正常启动,剩余可用内存不足100M,小文件可以上传,当上传大文件(300M)时出现内存溢出,日志如下,需要怎么处理