Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

unable to generate video output in heroku

I made this simple face detection and tracking app using flask, opencv and mediapipe. This works completely fine on my local host but when i deployed it on Heroku the the app is unable to show results . Can someone please tell me what’s the issue here ?
Deployment – http://face1-detection.herokuapp.com/

app.py:

import base64
import cv2
import io

import numpy as np
from PIL import Image
from engineio.payload import Payload
from flask import Flask, render_template
from flask_socketio import SocketIO, emit
import mediapipe as mp

Payload.max_decode_packets = 2048

app = Flask(__name__)
socketio = SocketIO(app, cors_allowed_origins='*')


@app.route('/', methods=['POST', 'GET'])
def index():
    return render_template('index.html')


def readb64(base64_string):
    idx = base64_string.find('base64,')
    base64_string = base64_string[idx + 7:]

    sbuf = io.BytesIO()

    sbuf.write(base64.b64decode(base64_string, ' /'))
    pimg = Image.open(sbuf)

    return cv2.cvtColor(np.array(pimg), cv2.COLOR_RGB2BGR)



@socketio.on('catch-frame')
def catch_frame(data):
    emit('response_back', data)



@socketio.on('image')
def image(data_image):
    frame = (readb64(data_image))
    frame = face_detector(frame)

    imgencode = cv2.imencode('.jpeg', frame, [cv2.IMWRITE_JPEG_QUALITY, 40])[1]

    # base64 encode
    stringData = base64.b64encode(imgencode).decode('utf-8')
    b64_src = 'data:image/jpeg;base64,'
    stringData = b64_src + stringData

    # emit the frame back
    emit('response_back', stringData)


def face_detector(img):
    mpFaceDetection = mp.solutions.face_detection
    faceDetection = mpFaceDetection.FaceDetection()

    img = cv2.flip(img, 1)
    results = faceDetection.process(img)
    if results.detections:
        for id, detection in enumerate(results.detections):
            if detection.score[0] > 0.50:
                bboxc = detection.location_data.relative_bounding_box
                ih, iw, ic = img.shape
                bbox = int(bboxc.xmin * iw), int(bboxc.ymin * ih), int(bboxc.width * iw), int(bboxc.height * ih)
                cv2.rectangle(img, bbox, (0, 255, 0), 2)
                cv2.putText(img, f"{int(detection.score[0] * 100)}%",
                            (int(bboxc.xmin * iw), int(bboxc.ymin * ih - 15)),
                            cv2.FONT_ITALIC, 1.5, (255, 255, 255), 2)

    cv2.waitKey(0)
    return img


if __name__ == '__main__':
    socketio.run(app, port=9990, debug=True)

index.html

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Face Detection/Tracking</title>

     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
     <script src='https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.0/socket.io.js'></script>
</head>

<body>

    <div id="container">
    <video autoplay playsinline id="videoElement"></video>
    <canvas id="canvas"  width="400" height="300"></canvas>
    </div>

    <div class = 'video'>
        <img id="photo"  width="400"  height="300">
    </div>

    <script type="text/javascript" charset="utf-8">

        var socket = io.connect(window.location.protocol + '//' + document.domain + ':' + location.port);
        socket.on('connect', function(){
            console.log("Connected...!", socket.connected)
        });


        var canvas = document.getElementById('canvas');
        var context = canvas.getContext('2d');
        const video = document.querySelector("#videoElement");

        video.width = 400;
        video.height = 300;


        if (navigator.mediaDevices.getUserMedia) {
            navigator.mediaDevices.getUserMedia({ video: true })
            .then(function (stream) {
                video.srcObject = stream;
                video.play();
            })
            .catch(function (err0r) {

            });
        }

        const FPS = 10;
        setInterval(() => {
            width=video.width;
            height=video.height;
            context.drawImage(video, 0, 0, width , height );
            var data = canvas.toDataURL('image/jpeg', 0.5);
            context.clearRect(0, 0, width,height );
            socket.emit('image', data);
        }, 1000/FPS);

        socket.on('response_back', function(image){
                photo.setAttribute('src', image );

        });

    </script>


 </body>

</html>

This is the literally the entrie code . If anyone know what’s the issue please let me know

heroku logs :

2022-02-24T12:25:42.965622+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/threading.py", line 973, in _bootstrap_inner
2022-02-24T12:25:42.965975+00:00 app[web.1]: self.run()
2022-02-24T12:25:42.965978+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/threading.py", line 910, in run
2022-02-24T12:25:42.966270+00:00 app[web.1]: self._target(*self._args, **self._kwargs)
2022-02-24T12:25:42.966271+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/socketio/server.py", line 682, in _handle_event_internal
2022-02-24T12:25:42.966505+00:00 app[web.1]: r = server._trigger_event(data[0], namespace, sid, *data[1:])
2022-02-24T12:25:42.966508+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/socketio/server.py", line 711, in _trigger_event
2022-02-24T12:25:42.966760+00:00 app[web.1]: return self.handlers[namespace][event](*args)
2022-02-24T12:25:42.966762+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_socketio/__init__.py", line 282, in _handler
2022-02-24T12:25:42.966976+00:00 app[web.1]: return self._handle_event(handler, message, namespace, sid,
2022-02-24T12:25:42.966988+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_socketio/__init__.py", line 713, in _handle_event
2022-02-24T12:25:42.967281+00:00 app[web.1]: ret = handler(*args)
2022-02-24T12:25:42.967283+00:00 app[web.1]: File "/app/app.py", line 45, in image
2022-02-24T12:25:42.967418+00:00 app[web.1]: frame = face_detector(frame)
2022-02-24T12:25:42.967421+00:00 app[web.1]: File "/app/app.py", line 75, in face_detector
2022-02-24T12:25:42.967505+00:00 app[web.1]: cv2.waitKey(0)
2022-02-24T12:25:42.967534+00:00 app[web.1]: cv2.error: OpenCV(4.5.5) /io/opencv/modules/highgui/src/window.cpp:1334: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'
2022-02-24T12:25:42.967534+00:00 app[web.1]:
2022-02-24T12:26:09.779758+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/socket.io/?EIO=3&transport=polling&t=NyhiQuB&sid=29235acf6cbb4841a384245766e80a2b" host=newfacetrack.herokuapp.com request_id=d61b9d83-a0e0-4eb0-9d24-dfe323cc4edd fwd="27.57.153.242" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
2022-02-24T12:26:10.655608+00:00 app[web.1]: [2022-02-24 12:26:10 +0000] [4] [CRITICAL] WORKER TIMEOUT (pid:186)
2022-02-24T12:26:10.656419+00:00 app[web.1]: [2022-02-24 12:26:10 +0000] [186] [INFO] Worker exiting (pid: 186)
2022-02-24T12:26:11.666532+00:00 app[web.1]: [2022-02-24 12:26:11 +0000] [4] [WARNING] Worker with pid 186 was terminated due to signal 9
2022-02-24T12:26:11.669039+00:00 app[web.1]: [2022-02-24 12:26:11 +0000] [234] [INFO] Booting worker with pid: 234
2022-02-24T12:26:13.042608+00:00 app[web.1]: 10.1.86.207 - - [24/Feb/2022:12:26:13 +0000] "POST /socket.io/?EIO=3&transport=polling&t=NyhiRpq&sid=9cc0990633a541dc87c57595bfb13d16 HTTP/1.1" 400 11 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:13.042740+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=NyhiQuB&sid=29235acf6cbb4841a384245766e80a2b" host=newfacetrack.herokuapp.com request_id=64b4b546-f9ce-453a-8066-104dc6255af5 fwd="27.57.153.242" dyno=web.1 connect=0ms service=2290ms status=400 bytes=217 protocol=https
2022-02-24T12:26:13.043767+00:00 app[web.1]: 10.1.61.212 - - [24/Feb/2022:12:26:13 +0000] "GET /socket.io/?EIO=3&transport=polling&t=NyhiQuB&sid=29235acf6cbb4841a384245766e80a2b HTTP/1.1" 400 11 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:13.043901+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=NyhiRpq&sid=9cc0990633a541dc87c57595bfb13d16" host=newfacetrack.herokuapp.com request_id=0bcad996-a7c6-46f0-8c10-8ceb1b47cfea fwd="27.57.153.242" dyno=web.1 connect=0ms service=29783ms status=400 bytes=282 protocol=https
2022-02-24T12:26:13.232505+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/socket.io/?EIO=3&transport=polling&t=NyhiReF&sid=9cc0990633a541dc87c57595bfb13d16" host=newfacetrack.herokuapp.com request_id=432efae7-3f32-4fc2-9afa-41ebf72254e3 fwd="27.57.153.242" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2022-02-24T12:26:13.429670+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=NyhiZBQ&sid=9cc0990633a541dc87c57595bfb13d16" host=newfacetrack.herokuapp.com request_id=e50fa29c-b6f2-4e69-9c25-4272b6a9ca3d fwd="27.57.153.242" dyno=web.1 connect=0ms service=1ms status=400 bytes=282 protocol=https
2022-02-24T12:26:13.430897+00:00 app[web.1]: 10.1.61.212 - - [24/Feb/2022:12:26:13 +0000] "POST /socket.io/?EIO=3&transport=polling&t=NyhiZBQ&sid=9cc0990633a541dc87c57595bfb13d16 HTTP/1.1" 400 11 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:13.696329+00:00 app[web.1]: [2022-02-24 12:26:13 +0000] [4] [CRITICAL] WORKER TIMEOUT (pid:194)
2022-02-24T12:26:13.697959+00:00 app[web.1]: [2022-02-24 12:26:13 +0000] [194] [INFO] Worker exiting (pid: 194)
2022-02-24T12:26:14.707233+00:00 app[web.1]: [2022-02-24 12:26:14 +0000] [4] [WARNING] Worker with pid 194 was terminated due to signal 9
2022-02-24T12:26:14.710332+00:00 app[web.1]: [2022-02-24 12:26:14 +0000] [242] [INFO] Booting worker with pid: 242
2022-02-24T12:26:15.048217+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=NyhiZah" host=newfacetrack.herokuapp.com request_id=e617be25-8fb5-4955-8d1a-f55828face7a fwd="27.57.153.242" dyno=web.1 connect=0ms service=5ms status=200 bytes=390 protocol=https
2022-02-24T12:26:15.049518+00:00 app[web.1]: 10.1.61.212 - - [24/Feb/2022:12:26:15 +0000] "GET /socket.io/?EIO=3&transport=polling&t=NyhiZah HTTP/1.1" 200 107 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:15.764956+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=NyhiZfu&sid=fe6ff1caa2e94b669a5ec16e1b3b560f" host=newfacetrack.herokuapp.com request_id=5f5ddd22-675e-40c9-9725-46a5a174d20a fwd="27.57.153.242" dyno=web.1 connect=0ms service=386ms status=200 bytes=264 protocol=https
2022-02-24T12:26:15.766176+00:00 app[web.1]: 10.1.61.212 - - [24/Feb/2022:12:26:15 +0000] "POST /socket.io/?EIO=3&transport=polling&t=NyhiZfu&sid=fe6ff1caa2e94b669a5ec16e1b3b560f HTTP/1.1" 200 2 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:15.819042+00:00 app[web.1]: INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
2022-02-24T12:26:15.843333+00:00 app[web.1]: Exception in thread Thread-2:
2022-02-24T12:26:15.843349+00:00 app[web.1]: Traceback (most recent call last):
2022-02-24T12:26:15.843365+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/threading.py", line 973, in _bootstrap_inner
2022-02-24T12:26:15.843762+00:00 app[web.1]: self.run()
2022-02-24T12:26:15.843777+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/threading.py", line 910, in run
2022-02-24T12:26:15.844159+00:00 app[web.1]: self._target(*self._args, **self._kwargs)
2022-02-24T12:26:15.844179+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/socketio/server.py", line 682, in _handle_event_internal
2022-02-24T12:26:15.844630+00:00 app[web.1]: r = server._trigger_event(data[0], namespace, sid, *data[1:])
2022-02-24T12:26:15.844744+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/socketio/server.py", line 711, in _trigger_event
2022-02-24T12:26:15.845771+00:00 app[web.1]: return self.handlers[namespace][event](*args)
2022-02-24T12:26:15.845792+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_socketio/__init__.py", line 282, in _handler
2022-02-24T12:26:15.846006+00:00 app[web.1]: return self._handle_event(handler, message, namespace, sid,
2022-02-24T12:26:15.846020+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_socketio/__init__.py", line 713, in _handle_event
2022-02-24T12:26:15.846336+00:00 app[web.1]: ret = handler(*args)
2022-02-24T12:26:15.846350+00:00 app[web.1]: File "/app/app.py", line 45, in image
2022-02-24T12:26:15.846458+00:00 app[web.1]: frame = face_detector(frame)
2022-02-24T12:26:15.846483+00:00 app[web.1]: File "/app/app.py", line 75, in face_detector
2022-02-24T12:26:15.846678+00:00 app[web.1]: cv2.waitKey(0)
2022-02-24T12:26:15.846748+00:00 app[web.1]: cv2.error: OpenCV(4.5.5) /io/opencv/modules/highgui/src/window.cpp:1334: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'
2022-02-24T12:26:15.846760+00:00 app[web.1]:
2022-02-24T12:26:16.866520+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=NyhiZsa&sid=fe6ff1caa2e94b669a5ec16e1b3b560f" host=newfacetrack.herokuapp.com request_id=6a81ebf1-8ab9-4a1e-96f3-537d564c3a59 fwd="27.57.153.242" dyno=web.1 connect=0ms service=676ms status=400 bytes=282 protocol=https
2022-02-24T12:26:16.867623+00:00 app[web.1]: 10.1.61.212 - - [24/Feb/2022:12:26:16 +0000] "POST /socket.io/?EIO=3&transport=polling&t=NyhiZsa&sid=fe6ff1caa2e94b669a5ec16e1b3b560f HTTP/1.1" 400 11 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:17.334909+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=Nyhia8Q&sid=fe6ff1caa2e94b669a5ec16e1b3b560f" host=newfacetrack.herokuapp.com request_id=9a67de4f-58e2-4919-a636-1ac3bf0d6ce7 fwd="27.57.153.242" dyno=web.1 connect=0ms service=1ms status=400 bytes=282 protocol=https
2022-02-24T12:26:17.336190+00:00 app[web.1]: 10.1.61.212 - - [24/Feb/2022:12:26:17 +0000] "POST /socket.io/?EIO=3&transport=polling&t=Nyhia8Q&sid=fe6ff1caa2e94b669a5ec16e1b3b560f HTTP/1.1" 400 11 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:19.037947+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=3&transport=polling&t=NyhiaZ4" host=newfacetrack.herokuapp.com request_id=57087b58-ce3a-4422-a17e-54751a6a665c fwd="27.57.153.242" dyno=web.1 connect=0ms service=1ms status=200 bytes=390 protocol=https
2022-02-24T12:26:19.039249+00:00 app[web.1]: 10.1.61.212 - - [24/Feb/2022:12:26:19 +0000] "GET /socket.io/?EIO=3&transport=polling&t=NyhiaZ4 HTTP/1.1" 200 107 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:19.377341+00:00 heroku[router]: at=info method=POST path="/socket.io/?EIO=3&transport=polling&t=NyhiaeH&sid=987213a56f574506a7fe38ec6a023e81" host=newfacetrack.herokuapp.com request_id=e5fbacaf-fd00-4b7e-9c45-5cb1fbe5d3c5 fwd="27.57.153.242" dyno=web.1 connect=0ms service=2ms status=200 bytes=264 protocol=https
2022-02-24T12:26:19.378487+00:00 app[web.1]: 10.1.61.212 - - [24/Feb/2022:12:26:19 +0000] "POST /socket.io/?EIO=3&transport=polling&t=NyhiaeH&sid=987213a56f574506a7fe38ec6a023e81 HTTP/1.1" 200 2 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:19.990013+00:00 app[web.1]: INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
2022-02-24T12:26:20.005617+00:00 app[web.1]: Exception in thread Thread-2:
2022-02-24T12:26:20.005620+00:00 app[web.1]: Traceback (most recent call last):
2022-02-24T12:26:20.005640+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/threading.py", line 973, in _bootstrap_inner
2022-02-24T12:26:20.006002+00:00 app[web.1]: self.run()
2022-02-24T12:26:20.006003+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/threading.py", line 910, in run
2022-02-24T12:26:20.006246+00:00 app[web.1]: self._target(*self._args, **self._kwargs)
2022-02-24T12:26:20.006249+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/socketio/server.py", line 682, in _handle_event_internal
2022-02-24T12:26:20.006393+00:00 app[web.1]: r = server._trigger_event(data[0], namespace, sid, *data[1:])
2022-02-24T12:26:20.006395+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/socketio/server.py", line 711, in _trigger_event
2022-02-24T12:26:20.006535+00:00 app[web.1]: return self.handlers[namespace][event](*args)
2022-02-24T12:26:20.006546+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_socketio/__init__.py", line 282, in _handler
2022-02-24T12:26:20.006625+00:00 app[web.1]: return self._handle_event(handler, message, namespace, sid,
2022-02-24T12:26:20.006627+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask_socketio/__init__.py", line 713, in _handle_event
2022-02-24T12:26:20.006775+00:00 app[web.1]: ret = handler(*args)
2022-02-24T12:26:20.006776+00:00 app[web.1]: File "/app/app.py", line 45, in image
2022-02-24T12:26:20.006819+00:00 app[web.1]: frame = face_detector(frame)
2022-02-24T12:26:20.006821+00:00 app[web.1]: File "/app/app.py", line 75, in face_detector
2022-02-24T12:26:20.006872+00:00 app[web.1]: cv2.waitKey(0)
2022-02-24T12:26:20.006909+00:00 app[web.1]: cv2.error: OpenCV(4.5.5) /io/opencv/modules/highgui/src/window.cpp:1334: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'
2022-02-24T12:26:20.006910+00:00 app[web.1]:
2022-02-24T12:26:45.394033+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/socket.io/?EIO=3&transport=polling&t=NyhiZfw&sid=fe6ff1caa2e94b669a5ec16e1b3b560f" host=newfacetrack.herokuapp.com request_id=c6c1e0b6-c6d6-4ad0-af76-43362b45e9fc fwd="27.57.153.242" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-02-24T12:26:45.997770+00:00 app[web.1]: [2022-02-24 12:26:45 +0000] [4] [CRITICAL] WORKER TIMEOUT (pid:234)
2022-02-24T12:26:45.998218+00:00 app[web.1]: [2022-02-24 12:26:45 +0000] [234] [INFO] Worker exiting (pid: 234)
2022-02-24T12:26:47.007109+00:00 app[web.1]: [2022-02-24 12:26:47 +0000] [4] [WARNING] Worker with pid 234 was terminated due to signal 9
2022-02-24T12:26:47.009926+00:00 app[web.1]: [2022-02-24 12:26:47 +0000] [282] [INFO] Booting worker with pid: 282
2022-02-24T12:26:48.611144+00:00 app[web.1]: 10.1.63.238 - - [24/Feb/2022:12:26:48 +0000] "POST /socket.io/?EIO=3&transport=polling&t=Nyhiajz&sid=987213a56f574506a7fe38ec6a023e81 HTTP/1.1" 400 11 "https://newfacetrack.herokuapp.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"
2022-02-24T12:26:48.611974+00:00 heroku[router]: sock=client at=warning code=H27 desc="Client Request Interrupted" method=POST path="/socket.io/?EIO=3&transport=polling&t=Nyhiajz&sid=987213a56f574506a7fe38ec6a023e81" host=newfacetrack.herokuapp.com request_id=ef81a1bf-da56-4bf0-9258-f8589af364bb fwd="27.57.153.242" dyno=web.1 connect=0ms service=28603ms status=499 bytes= protocol=https
2022-02-24T12:26:49.699755+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/socket.io/?EIO=3&transport=polling&t=NyhiaeJ&sid=987213a56f574506a7fe38ec6a023e81" host=newfacetrack.herokuapp.com request_id=13ab5d74-ff0b-42c2-8327-bd40c0900da2 fwd="27.57.153.242" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-02-24T12:26:50.065428+00:00 app[web.1]: [2022-02-24 12:26:50 +0000] [4] [CRITICAL] WORKER TIMEOUT (pid:242)
2022-02-24T12:26:50.067465+00:00 app[web.1]: [2022-02-24 12:26:50 +0000] [242] [INFO] Worker exiting (pid: 242)
2022-02-24T12:26:51.080378+00:00 app[web.1]: [2022-02-24 12:26:51 +0000] [4] [WARNING] Worker with pid 242 was terminated due to signal 9
2022-02-24T12:26:51.082532+00:00 app[web.1]: [2022-02-24 12:26:51 +0000] [290] [INFO] Booting worker with pid: 290

>Solution :

The Python code currently uses waitKey(0) but that doesn’t make sense in this context. Nobody is sitting inside the data centre waiting to press a key on a keyboard for you.

Remove that from your code and I think you’ll be good to go.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading