Check style pipe failing with out of memory error
Asked by Andrew Macdonald:

tried many different options including increasing memory and turning on debug for the pipe and always get the same error.

"library initialization failed - unable to allocate file descriptor table - out of memory"

with no additional information.

current pipe step is:  
- step:  
name: Build and Test  
runs-on:  
- self.hosted  
- linux  
caches:  
- maven  
script:  
- mvn -V -B -U clean install checkstyle:checkstyle help:effective-pom -Dmaven.test.skip=false -s settings.xml  
artifacts:  
- "target/coverage-reports/\*\*"  
- "target/surefire-reports/\*\*"  
- "target/checkstyle-result.xml"  
after-script:  
# Collect checkstyle results, if any, and convert to Bitbucket Code Insights.  
- pipe: atlassian/checkstyle-report:0.3.0  
variables:  
DEBUG: 'true'  
verified there is a checkstyle-result.xml file in the target folder and it is attached as an artifact to the pipeline result.


Answers:
author: Patrik S
body: Hello [@Andrew Macdonald](/t5/user/viewprofilepage/user-id/4903155) and thank you for reaching out to Community!

A pipe is essentially a separate container that is spun up to run a custom script. Since it's running in a separate container, it will use the memory allocated to the **docker service**, which by default is 1024MB.

As the error being returned is related to out-of-memory, I would suggest trying to increase the memory allocated to the docker service (and therefore for the pipe) by including the following definition on the top of your YML file :

```
definitions:
  services:
    docker:
      memory: 2048  # increase memory for docker-in-docker from 1GB to 2GB
```

You can increase this value up to 3072MB for regular steps, and 7128MB for steps configured as large steps ([size: 2x](https://support.atlassian.com/bitbucket-cloud/docs/step-options/#Size)).

For more details about how the memory is allocated in Pipelines, you're also welcome to have a look at the following documentation:

* <https://support.atlassian.com/bitbucket-cloud/docs/databases-and-service-containers/>

Thank you, [@Andrew Macdonald](/t5/user/viewprofilepage/user-id/4903155) !

Patrik S

comments: author: Andrew Macdonald
body: I added the Definitions as suggested first setting memory at 2048 with default size 1x on the step. Still got the same error.

I then tried memory 4096 and size 2x. I still got the same error.

I'm running this pipe on a self hosted runner and I think that may be the issue and the memory error reported is actually not the true issue.

I tried running this as a separate step on a cloud runner instead of as an after-script on a self hosted runner. It ran for a much longer time (4+ minutes as opposed to 4s) and errored with the following "time="2023-06-06T18:06:11Z" level=error msg="error waiting for container: unexpected EOF""

Are there known issues with running this pipe on a selfhosted runner?


author: Andrew Macdonald
body: [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) the memory suggestions didn't correct my issues. Error appears to be a false error and issue appears to be related to running pipe on hosted runner.


author: Patrik S
body: Hello [@Andrew Macdonald](/t5/user/viewprofilepage/user-id/4903155) ,

I was trying to reproduce the error using a Linux docker self-hosted runner on a host with Ubuntu 20.04.6 LTS and using the pipe atlassian/checkstyle-report:0.3.0 and the build was completed successfully, so I think the issue is using pipes with self-hosted runners.

In this case, could you confirm if the host where you are executing the runner meets the [Runner's Supported Platforms and Minimum requirements](https://support.atlassian.com/bitbucket-cloud/docs/runners/)?

Also, I was checking the [checkstyle-report pipe official repository](https://bitbucket.org/atlassian/checkstyle-report/src/master/) and see the latest version available for that pipe is 0.4.0. Could you please try updating to that version and check if there's any improvement?

Thank you, [@Andrew Macdonald](/t5/user/viewprofilepage/user-id/4903155) !

Patrik S


Tags: bitbucket-cloud

bitbucket-pipelines

cloud