question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Connection aborted.', error(32, 'Broken pipe' when uploading ImageMagick

See original GitHub issue

I’m using Moviepy to make captioned videos on the python Lambda. ImageMagick is a dependency of Moveipy and comes preinstalled on Lambda, which would be great; however, when I try to create a frame using moviepy.TextClip, I get the following error:

MoviePy Error: creation of None failed because of the following error:
 
convert: not authorized `@/tmp/tmpafOCVo.txt' @ error/constitute.c/ReadImage/454.
convert: no images defined `PNG32:/tmp/tmphhE8gT.png' @ error/convert.c/ConvertImageCommand/3046.

This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or.that the path you specified is incorrect: IOError

I googled forever and it looks like the problem is fallout from https://alas.aws.amazon.com/ALAS-2016-699.html. “This update contains an updated /etc/ImageMagick/policy.xml file that disables the EPHEMERAL, HTTPS, HTTP, URL, FTP, MVG, MSL, TEXT, and LABEL coders.”

It also says, “if you experience any problems after the update, it may be necessary to manually adjust the policy.xml file to match your requirements.” But I can’t do that on Lambda.

StackOverflow folks suggest repackaging lambda and uploading it to Lambda yourself (http://stackoverflow.com/questions/37046586/aws-lambda-not-working-along-with-the-gm-module) but whenever I add ImageMagick to the vendor folder and try to deploy I get a broken pipe error from Botocore

  File "/usr/local/bin/chalice", line 9, in <module>
    load_entry_point('chalice==0.5.1', 'console_scripts', 'chalice')()
  File "/usr/local/lib/python2.7/site-packages/chalice/cli/__init__.py", line 298, in main
    return cli(obj={})
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/chalice/cli/__init__.py", line 177, in deploy
    d.deploy(config)
  File "/usr/local/lib/python2.7/site-packages/chalice/deployer.py", line 272, in deploy
    self._lambda_deploy.deploy(config)
  File "/usr/local/lib/python2.7/site-packages/chalice/deployer.py", line 665, in deploy
    self._update_lambda_function(config)
  File "/usr/local/lib/python2.7/site-packages/chalice/deployer.py", line 748, in _update_lambda_function
    zip_contents)
  File "/usr/local/lib/python2.7/site-packages/chalice/awsclient.py", line 86, in update_function_code
    FunctionName=function_name, ZipFile=zip_contents)
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 159, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 483, in _make_api_call
    operation_model, request_dict)
  File "/usr/local/lib/python2.7/site-packages/botocore/endpoint.py", line 141, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/lib/python2.7/site-packages/botocore/endpoint.py", line 170, in _send_request
    success_response, exception):
  File "/usr/local/lib/python2.7/site-packages/botocore/endpoint.py", line 249, in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
  File "/usr/local/lib/python2.7/site-packages/botocore/hooks.py", line 227, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/hooks.py", line 210, in _emit
    response = handler(**kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "/usr/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 251, in __call__
    caught_exception)
  File "/usr/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 277, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "/usr/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 317, in __call__
    caught_exception)
  File "/usr/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "/usr/local/lib/python2.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
botocore.vendored.requests.exceptions.ConnectionError: ('Connection aborted.', error(32, 'Broken pipe'))

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jameslscommented, Mar 1, 2017

Ok, I’ll take a look and see if I can repro.

0reactions
kyleknapcommented, Jun 13, 2017

I am able to reproduce this issue. What is happening is Lambda only allows for a 50 MB deployment package. So if the deployment package is over 50 MB, the service will try to send an error message back about the deployment package and abort the connection. For this case though, the aborted connection happens as chalice is still sending data before the error message is returned resulting in a general connection error.

Unfortunately, there is not really much we can do to make the deployment actually go through given Lambda controls the deployment size limit. While there may be optimizations chalice could make to decrease the deployment size, I think it is important at the very least to detect this error and raise a more informative error related to the deployment package being too large.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Broken pipe error - Legacy ImageMagick Discussions Archive
Hello hello, New user to IM, I try to compare 2 images and showing the resulting in IMDisplay directly (without creating a file)...
Read more >
AWS Lambda ImageMagick convert not authorized
ConnectionError: ('Connection aborted.', error(32, 'Broken pipe')) ) and c) it's been over six months since this change was made has ...
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug listing with status RESOLVED with resolution FIXED as at 2022/12/17 06:46:03.
Read more >
Untitled
mod_ssl: | - fail quickly if SSL connection is aborted rather than making ... This was broken after | such children stopped inheriting...
Read more >
Supplemental Document: BIG-IP 13.0.0 Fixes and Known Issues
602358, 3-Major, BIG-IP ServerSSL connection may reset during rengotiation with some SSL/TLS servers ... 579495, 3-Major, Error when loading Upgrade UCS☆.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found