My App is constantly throwing the same error since its deployed ! 😞

Weeks ago, I created magical image art app which worked fine locally & then I deployed it on Streamlit Cloud.

This error has been constant since deployment, and now I’m very confused at this point because I can’t really figure out what is the actual issue here.

:link: Github repo: GitHub - ShruAgarwal/Magical_Image_Art: Try this Streamlit App and receive three different styled effects out of an Image! 😉🌈

Earlier errors I came across & solved as well:

  • correct use of opencv library in requirements.txt file
  • removing the latest version of streamlit because of compatibility
  • reducing the use of image-comparison component due to ugly output on the final app.

It will be a great help if someone could point out the actual error of this app :pray:
Thanks :slightly_smiling_face:

As a quick thing to try, have you tried deleting and then redeploying the app?

1 Like

Yes, I have did this twice. Also, I have rebooted the app three times!

Sorry about that. Looks like a really cool app! Let me see what I can figure out.

1 Like

It seems that the issue is here:
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py”, line 557, in _run_script
exec(code, module.dict)
File “st_app.py”, line 135, in
cartoon_img = cartoon_style(display_image)
File “st_app.py”, line 93, in cartoon_style
cartoon_image = cv2.stylization(image_1, sigma_s=150, sigma_r=0.25)
cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function ‘stylization’

  • Overload resolution failed:
  • src data type = 17 is not supported
  • Expected Ptrcv::UMat for argument ‘src’
1 Like

Odd, I just forked the repo and it deployed in Streamlit Cloud without issues. Link to app.


edit: using streamlit 1.12.2 works fine as well


edit2: without changing anything, the app now fails showing the same issue in the logs :hushed:


edit3: refactored the code a little bit to reboot the app in Streamlit Cloud. It’s working again… but it might break again? I suspect the problem comes from the streamlit-image-comparison component that writes opencv images that are supposed to be temporal but are never cleaned, and possibly never released.

1 Like

After keeping the errors mentioned by @Alex_Toader & @edsaac in mind, I tried –

  • Adding try-except blocks in cartoon_style & waterColor_style functions.
  • Changed the code for cartoon_style function as it cv2.stylization was throwing several errors.
  • Removed st-image-comparison component from requirements.txt & st_app.py files
  • Deleted the app & Redeployed it again HERE

Now, it’s showing these logs :point_down:

[12:07:29] 🐍 Python dependencies were installed from /app/magical_image_art/requirements.txt using pip.
[12:07:29] 📦 Processed dependencies!
[12:07:32] 🖥 Provisioning machine...
[12:07:33] 🎛 Preparing system...
[12:07:33] ⛓ Spinning up manager process...
[12:07:33] 🔄 Updated app!
python: malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
[12:09:38] ❗️ Streamlit server consistently failed status checks
[12:09:38] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

Please help me where I’m going wrong :pray:

Thanks, @blackary :slightly_smiling_face: Please let me know where I’m going wrong…

It’s been a couple days and the version from my fork has not failed yet. The only meaningful change was that the image processing only gets triggered when both st.button('See the Magic! 🎉') and st.file_uploader("UPLOAD AN IMAGE") evaluate to True. In the earlier version, only the st.button('See the Magic! 🎉') was checked, so if the app was run without an uploaded file, it would throw an exception.

:link: Run it in Streamlit cloud

:link: GitHub repository with my forked version

st_imagesfork

1 Like

Thanks for your constant update @edsaac :slightly_smiling_face: Right now, even my new app link is working fine!
Let’s see how long it works well…

Update: Today, the same error occurred. Please let me know what’s the issue :pray:

Just to double-check, it’s still showing this error in the logs? Or something else?

[quote=“ShruAgarwal, post:7, topic:30535”]

python: malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Here’s the error:

2022-09-16 19:48:40.280 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
    exec(code, module.__dict__)
  File "st_app.py", line 161, in <module>
    pop_art(display_image)
  File "st_app.py", line 50, in pop_art
    image = cv2.cvtColor(original, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function 'cvtColor'
> Overload resolution failed:
>  - src data type = 17 is not supported
>  - Expected Ptr<cv::UMat> for argument 'src'
malloc(): invalid size (unsorted)
[12:25:04] ❗️ Streamlit server consistently failed status checks
[12:25:04] ❗️ Please fix the errors, push an update to the git repo, or reboot the app.

That looks like it might be a different error than before, so that’s interesting. Have you tried this suggestion python - cv2.error: OpenCV(4.5.2) 👎 error: (-5:Bad argument) in function 'cvtColor' - Stack Overflow?

Yes, I tried but it doesn’t seem to solve the actual issue :sweat_smile: Right now, my app is running without any issues. I’ll keep monitoring how long it works well…

:frowning_face: Sorry to hear it didn’t solve the issue, but glad to hear it’s running without any issues.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.