Git Product home page Git Product logo

Comments (2)

smuehlst avatar smuehlst commented on May 30, 2024

I'm a step further now. I realized that the timeout is not related to the HTTP transfer, but apparently to the reading of the frame from the video device. If I set the frame size to a smaller value, then the timeout does not happen, but something else fails:

$ ./http_mjpeg_streamer -m -s 160x120
Available formats:
YUYV 4:2:2
Motion-JPEG
Supported frame sizes for format YUYV 4:2:2
160x120
176x144
320x240
352x288
640x480
800x600
1280x960
1280x1024
1600x1200
Requesting YUYV 4:2:2 1600x1200
Resulting image format: YUYV 4:2:2 1600x1200
2018/08/11 15:51:35 connect from [2001:a61:5f2:900:f9dc:f60d:4978:38d0]:51637 /
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x28c7c2, 0x16)
        /usr/lib/go-1.7/src/runtime/panic.go:566 +0x78
runtime.sysMap(0x10e60000, 0x100000, 0x122901, 0x382b80)
        /usr/lib/go-1.7/src/runtime/mem_linux.go:230 +0x15c
runtime.(*mheap).sysAlloc(0x374ef8, 0x100000, 0x10600b9c)
        /usr/lib/go-1.7/src/runtime/malloc.go:407 +0x144
runtime.(*mheap).grow(0x374ef8, 0x8, 0x0)
        /usr/lib/go-1.7/src/runtime/mheap.go:726 +0x68
runtime.(*mheap).allocSpanLocked(0x374ef8, 0x1, 0x215a8)
        /usr/lib/go-1.7/src/runtime/mheap.go:630 +0x634
runtime.(*mheap).alloc_m(0x374ef8, 0x1, 0x2, 0x3a500, 0x371e58)
        /usr/lib/go-1.7/src/runtime/mheap.go:515 +0x138
runtime.(*mheap).alloc.func1()
        /usr/lib/go-1.7/src/runtime/mheap.go:579 +0x40
runtime.systemstack(0xb6490d68)
        /usr/lib/go-1.7/src/runtime/asm_arm.s:261 +0xa8
runtime.(*mheap).alloc(0x374ef8, 0x1, 0x2, 0x100, 0x287f0)
        /usr/lib/go-1.7/src/runtime/mheap.go:580 +0x58
runtime.(*mcentral).grow(0x3759f8, 0x0)
        /usr/lib/go-1.7/src/runtime/mcentral.go:210 +0xb0
runtime.(*mcentral).cacheSpan(0x3759f8, 0xb6db87c0)
        /usr/lib/go-1.7/src/runtime/mcentral.go:91 +0x644
runtime.(*mcache).refill(0xb6db2000, 0x2, 0xb6db87c0)
        /usr/lib/go-1.7/src/runtime/mcache.go:121 +0xd4
runtime.(*mcache).nextFree.func1()
        /usr/lib/go-1.7/src/runtime/malloc.go:505 +0x28
runtime.systemstack(0x1061c000)
        /usr/lib/go-1.7/src/runtime/asm_arm.s:247 +0x80
runtime.mstart()
        /usr/lib/go-1.7/src/runtime/proc.go:1079

goroutine 5 [running]:
runtime.systemstack_switch()
        /usr/lib/go-1.7/src/runtime/asm_arm.s:192 +0x4 fp=0x10649330 sp=0x1064932c
runtime.(*mcache).nextFree(0xb6db2000, 0x10e4b002, 0x10e5fbf0, 0xb6db87c0, 0x1000)
        /usr/lib/go-1.7/src/runtime/malloc.go:506 +0x154 fp=0x10649354 sp=0x10649330
runtime.mallocgc(0x3, 0x26c280, 0x10a01, 0x214a6)
        /usr/lib/go-1.7/src/runtime/malloc.go:635 +0x474 fp=0x106493f4 sp=0x10649354
runtime.newobject(0x26c280, 0x0)
        /usr/lib/go-1.7/src/runtime/malloc.go:785 +0x30 fp=0x10649408 sp=0x106493f4
runtime.convT2I(0x35a1a0, 0x10649438, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/runtime/iface.go:188 +0x84 fp=0x10649420 sp=0x10649408
image.(*YCbCr).At(0x1061a080, 0x166, 0x55, 0x0, 0x0)
        /usr/lib/go-1.7/src/image/ycbcr.go:71 +0x6c fp=0x1064943c sp=0x10649420
image/jpeg.toYCbCr(0x35b790, 0x1061a080, 0x160, 0x50, 0x106494f4, 0x106499f4, 0x106495f4)
        /usr/lib/go-1.7/src/image/jpeg/writer.go:396 +0xcc fp=0x1064947c sp=0x1064943c
image/jpeg.(*encoder).writeSOS(0x10674000, 0x35b790, 0x1061a080)
        /usr/lib/go-1.7/src/image/jpeg/writer.go:522 +0x318 fp=0x10649e0c sp=0x1064947c
image/jpeg.Encode(0x359960, 0x106180c0, 0x35b790, 0x1061a080, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/image/jpeg/writer.go:607 +0x404 fp=0x10649ee0 sp=0x10649e0c
main.encodeToImage(0x1060ce40, 0x1061a3c0, 0x1061a380, 0x1061a340, 0x640, 0x4b0, 0x56595559)
        /home/stm/golang/src/github.com/blackjack/webcam/examples/http_mjpeg_streamer/webcam.go:227 +0x3bc fp=0x10649fac sp=0x10649ee0
runtime.goexit()
        /usr/lib/go-1.7/src/runtime/asm_arm.s:998 +0x4 fp=0x10649fac sp=0x10649fac
created by main.main
        /home/stm/golang/src/github.com/blackjack/webcam/examples/http_mjpeg_streamer/webcam.go:141 +0xe9c

goroutine 1 [syscall]:
syscall.Syscall6(0x8e, 0x4, 0x10647c94, 0x0, 0x0, 0x10647c84, 0x0, 0x2a05f5e7, 0x1, 0x3b9aca00)
        /usr/lib/go-1.7/src/syscall/asm_linux_arm.s:48 +0x8
golang.org/x/sys/unix.Select(0x4, 0x10647c94, 0x0, 0x0, 0x10647c84, 0x0, 0x0, 0x0)
        /home/stm/golang/src/golang.org/x/sys/unix/zsyscall_linux_arm.go:1954 +0x84
github.com/blackjack/webcam.waitForFrame(0x3, 0x5, 0x248680, 0x0, 0x0)
        /home/stm/golang/src/github.com/blackjack/webcam/v4l2.go:411 +0x330
github.com/blackjack/webcam.(*Webcam).WaitForFrame(0x1060ce40, 0x5, 0x0, 0x0)
        /home/stm/golang/src/github.com/blackjack/webcam/webcam.go:211 +0x34
main.main()
        /home/stm/golang/src/github.com/blackjack/webcam/examples/http_mjpeg_streamer/webcam.go:153 +0xf3c

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /usr/lib/go-1.7/src/runtime/asm_arm.s:998 +0x4

goroutine 6 [IO wait]:
net.runtime_pollWait(0xb5c57060, 0x72, 0x0)
        /usr/lib/go-1.7/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).wait(0x1061a438, 0x72, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/fd_poll_runtime.go:73 +0x34
net.(*pollDesc).waitRead(0x1061a438, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/fd_poll_runtime.go:78 +0x30
net.(*netFD).accept(0x1061a400, 0x0, 0x359de0, 0x1066b060)
        /usr/lib/go-1.7/src/net/fd_unix.go:419 +0x21c
net.(*TCPListener).accept(0x10626608, 0x2470d1ff, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/tcpsock_posix.go:132 +0x30
net.(*TCPListener).AcceptTCP(0x10626608, 0x6d35c, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/tcpsock.go:209 +0x9c
net/http.tcpKeepAliveListener.Accept(0x10626608, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/http/server.go:2608 +0x3c
net/http.(*Server).Serve(0x10664af0, 0x35b970, 0x10626608, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/http/server.go:2273 +0x200
net/http.(*Server).ListenAndServe(0x10664af0, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/http/server.go:2219 +0xf4
net/http.ListenAndServe(0x2875f4, 0x5, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/http/server.go:2351 +0x90
main.httpImage(0x2875f4, 0x5, 0x1061a340)
        /home/stm/golang/src/github.com/blackjack/webcam/examples/http_mjpeg_streamer/webcam.go:272 +0x7c
created by main.main
        /home/stm/golang/src/github.com/blackjack/webcam/examples/http_mjpeg_streamer/webcam.go:143 +0xeec

goroutine 8 [chan receive]:
main.httpImage.func1(0x35b8d0, 0x1065c090, 0x1060a500)
        /home/stm/golang/src/github.com/blackjack/webcam/examples/http_mjpeg_streamer/webcam.go:259 +0x18c
net/http.HandlerFunc.ServeHTTP(0x106265f8, 0x35b8d0, 0x1065c090, 0x1060a500)
        /usr/lib/go-1.7/src/net/http/server.go:1726 +0x34
net/http.(*ServeMux).ServeHTTP(0x371f28, 0x35b8d0, 0x1065c090, 0x1060a500)
        /usr/lib/go-1.7/src/net/http/server.go:2022 +0x164
net/http.serverHandler.ServeHTTP(0x10664af0, 0x35b8d0, 0x1065c090, 0x1060a500)
        /usr/lib/go-1.7/src/net/http/server.go:2202 +0x150
net/http.(*conn).serve(0x1061a300, 0x35bc48, 0x1060d060)
        /usr/lib/go-1.7/src/net/http/server.go:1579 +0xde8
created by net/http.(*Server).Serve
        /usr/lib/go-1.7/src/net/http/server.go:2293 +0x470

goroutine 9 [IO wait]:
net.runtime_pollWait(0xb5c56f70, 0x72, 0x10dee000)
        /usr/lib/go-1.7/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).wait(0x1061a578, 0x72, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/fd_poll_runtime.go:73 +0x34
net.(*pollDesc).waitRead(0x1061a578, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/fd_poll_runtime.go:78 +0x30
net.(*netFD).Read(0x1061a540, 0x10dee000, 0x1000, 0x1000, 0x0, 0x35a638, 0x106140a0)
        /usr/lib/go-1.7/src/net/fd_unix.go:243 +0x1f0
net.(*conn).Read(0x10626218, 0x10dee000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/net.go:173 +0xb8
net/http.(*connReader).Read(0x1060ce80, 0x10dee000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/http/server.go:586 +0x1d8
bufio.(*Reader).fill(0x10616450)
        /usr/lib/go-1.7/src/bufio/bufio.go:97 +0x1c4
bufio.(*Reader).ReadSlice(0x10616450, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/bufio/bufio.go:330 +0x264
bufio.(*Reader).ReadLine(0x10616450, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/bufio/bufio.go:359 +0x60
net/textproto.(*Reader).readLineSlice(0x1060cfe0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/textproto/reader.go:55 +0x58
net/textproto.(*Reader).ReadLine(0x1060cfe0, 0x0, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/textproto/reader.go:36 +0x34
net/http.readRequest(0x10616450, 0x23a00, 0x1060a380, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/http/request.go:793 +0x80
net/http.(*conn).readRequest(0x1061a5c0, 0x35bc48, 0x1060cfa0, 0x0, 0x0, 0x0)
        /usr/lib/go-1.7/src/net/http/server.go:765 +0x3d4
net/http.(*conn).serve(0x1061a5c0, 0x35bc48, 0x1060cfa0)
        /usr/lib/go-1.7/src/net/http/server.go:1532 +0x910
created by net/http.(*Server).Serve
        /usr/lib/go-1.7/src/net/http/server.go:2293 +0x470

Apparently the Raspberry Pi doesn't have enough memory to encode the image.

What looks strange is the following message:

Resulting image format: YUYV 4:2:2 1600x1200

Is that expected when I request image size 160x120 with the command line option -s 160x120?

from webcam.

smuehlst avatar smuehlst commented on May 30, 2024

I have stripped down the example program so it fits my needs and so that it doesn't fail because of memory shortage, therefore I'm closing the issue. It would still be interesting though whether the inability to request a smaller image size is expected behavior.

from webcam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.