Giter Site home page Giter Site logo

Comments (12)

ljani avatar ljani commented on September 26, 2024 1

I'm hitting this issue as well, when there are thousands of pages. It seems there is a Chromium bug of increased memory usage from 2022: https://issues.chromium.org/issues/40842550

from gotenberg.

bendavies avatar bendavies commented on September 26, 2024

here's the extend of the logs, with debug logging:

Jan 30 13:41:09 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622069.2964118,"logger":"api.formschromiumconverthtml","msg":"form fields: map[]","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:09 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622069.296443,"logger":"api.formschromiumconverthtml","msg":"form files: map[index.html:/tmp/9b257b19-777b-4054-a89f-ba973715d14d/52bbcf8c-2a5c-40a7-89ab-6d6f1c54c8f6/index.html]","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:09 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622069.2965171,"logger":"api.formschromiumconverthtml","msg":"process lock acquired","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:09 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622069.3561296,"logger":"api.formschromiumconverthtml","msg":"JavaScript not disabled","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:09 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622069.356134,"logger":"api.formschromiumconverthtml","msg":"no extra HTTP headers","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:09 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622069.3561387,"logger":"api.formschromiumconverthtml","msg":"navigate to 'file:///tmp/9b257b19-777b-4054-a89f-ba973715d14d/52bbcf8c-2a5c-40a7-89ab-6d6f1c54c8f6/index.html'","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:09 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622069.3573983,"logger":"api.formschromiumconverthtml","msg":"event EventRequestPaused fired for 'file:///tmp/9b257b19-777b-4054-a89f-ba973715d14d/52bbcf8c-2a5c-40a7-89ab-6d6f1c54c8f6/index.html'","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:09 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622069.5936036,"logger":"api.formschromiumconverthtml","msg":"event LoadingFinished fired","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:10 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622070.3006866,"logger":"api.formschromiumconverthtml","msg":"event DomContentEventFired fired","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:10 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622070.3453834,"logger":"api.formschromiumconverthtml","msg":"event LoadEventFired fired","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:12 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622072.3455565,"logger":"api.formschromiumconverthtml","msg":"event networkIdle fired","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:12 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622072.3455667,"logger":"api.formschromiumconverthtml","msg":"default white background not hidden","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:12 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622072.400094,"logger":"api.formschromiumconverthtml","msg":"no emulated media type","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:12 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622072.4000986,"logger":"api.formschromiumconverthtml","msg":"no wait delay","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:12 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622072.4001014,"logger":"api.formschromiumconverthtml","msg":"no wait expression","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:12 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622072.4001086,"logger":"api.formschromiumconverthtml","msg":"no custom header nor footer","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:12 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622072.4001312,"logger":"api.formschromiumconverthtml","msg":"print to Pdf with: &{Landscape:false DisplayHeaderFooter:false PrintBackground:false Scale:1 PaperWidth:8.5 PaperHeight:11 MarginTop:0.39 MarginBottom:0.39 MarginLeft:0.39 MarginRight:0.39 PageRanges: HeaderTemplate: FooterTemplate: PreferCSSPageSize:false TransferMode:ReturnAsStream GenerateTaggedPDF:false}","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:13 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622073.4530144,"logger":"api.formschromiumconverthtml","msg":"process lock released","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:13 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"debug","ts":1706622073.45323,"logger":"api.formschromiumconverthtml","msg":"'/tmp/9b257b19-777b-4054-a89f-ba973715d14d/52bbcf8c-2a5c-40a7-89ab-6d6f1c54c8f6' context's working directory removed","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2"}
Jan 30 13:41:13 18.236.18.74 gotenberg|7.10.1|e9299f73d852: {"level":"error","ts":1706622073.4532683,"logger":"api","msg":"convert HTML to PDF: convert to PDF: print to PDF: print to Pdf: Printing failed (-32000)","trace":"a8a54b96-fb56-42c0-a26e-f7feedaeddc2","remote_ip":"10.14.21.73","host":"gotenberg.owsy.aws","uri":"/forms/chromium/convert/html","method":"POST","path":"/forms/chromium/convert/html","referer":"","user_agent":"GuzzleHttp/7","status":500,"latency":4195664578,"latency_human":"4.195664578s","bytes_in":2286261,"bytes_out":21}

from gotenberg.

bendavies avatar bendavies commented on September 26, 2024

I spotted errorCode: 9 in some other logs, indicating that chrome was just killed.
I think chrome is just OOMing.
Increased memory and generated my 84 page pdf just fine.

PrinterSettings/-32000 seems a red herring

from gotenberg.

gulien avatar gulien commented on September 26, 2024

Hello @bendavies

Printing failed (-32000) does not look like an ErrInvalidPrinterSettings, which occurs on aberrant margin values for instance, but more of a generic error (first time seeing it btw).

I spotted errorCode: 9 in some other logs, indicating that chrome was just killed.

Did your healthcheck restart your Gotenberg instance? πŸ€”

from gotenberg.

eldario avatar eldario commented on September 26, 2024

@bendavies

I encountered this problem yesterday. When generating a document of 242 pages.

Old helm values

Limits:
  cpu:     1
  memory:  512Mi   

After the request /forms/chromium/convert/url the container restarted

convert URL to PDF: convert to PDF: handle tasks: print to PDF: Printing failed (-32000)

I noticed that a graceful shutdown is happening

[SYSTEM] graceful shutdown of 30s

The graphs looked like this
ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

Raising memory limits resulted in normal operation

Limits:
  cpu:     1
  memory:  1024Mi   

from gotenberg.

gulien avatar gulien commented on September 26, 2024

Thanks @eldario!

from gotenberg.

gulien avatar gulien commented on September 26, 2024

Thanks for the detaisl @ljani!

from gotenberg.

gulien avatar gulien commented on September 26, 2024

Documentation has been updated πŸ‘

from gotenberg.

PureKrome avatar PureKrome commented on September 26, 2024

Sorry to ask the same question in a closed issue but I didn't want to open a new one when it's basically the same.

I'm getting the same issue. My guess is that it's trying to go through all PDF modules and each one is giving an error:

gotenberg.pdfgenerator  | {"level":"error","ts":1708610294.6408913,"logger":"api","msg":"convert HTML to PDF: convert to PDF: handle tasks: print to PDF: Printing failed (-32000)","trace":"32aa2f46-c05a-4c6d-8503-13d695cb8b23","remote_ip":"172.18.0.1","host":"localhost:3000","uri":"/forms/chromium/convert/html","method":"POST","path":"/forms/chromium/convert/html","referer":"","user_agent":"GotenbergSharpClient","status":500,"latency":2470028200,"latency_human":"2.4700282s","bytes_in":31122,"bytes_out":21}
gotenberg.pdfgenerator  | {"level":"error","ts":1708610298.279697,"logger":"api","msg":"convert HTML to PDF: convert to PDF: handle tasks: print to PDF: Printing failed (-32000)","trace":"2cefde9f-0793-4378-95e5-fc0709b75227","remote_ip":"172.18.0.1","host":"localhost:3000","uri":"/forms/chromium/convert/html","method":"POST","path":"/forms/chromium/convert/html","referer":"","user_agent":"GotenbergSharpClient","status":500,"latency":2120825016,"latency_human":"2.120825016s","bytes_in":31122,"bytes_out":21}
gotenberg.pdfgenerator  | {"level":"error","ts":1708610302.6704655,"logger":"api","msg":"convert HTML to PDF: convert to PDF: handle tasks: print to PDF: Printing failed (-32000)","trace":"067c80da-6758-4b6d-809e-84e71c994492","remote_ip":"172.18.0.1","host":"localhost:3000","uri":"/forms/chromium/convert/html","method":"POST","path":"/forms/chromium/convert/html","referer":"","user_agent":"GotenbergSharpClient","status":500,"latency":2129112124,"latency_human":"2.129112124s","bytes_in":31122,"bytes_out":21}
gotenberg.pdfgenerator  | {"level":"error","ts":1708610308.1901655,"logger":"api","msg":"convert HTML to PDF: convert to PDF: handle tasks: print to PDF: Printing failed (-32000)","trace":"a5420522-da30-4dac-9ac1-b43829952cce","remote_ip":"172.18.0.1","host":"localhost:3000","uri":"/forms/chromium/convert/html","method":"POST","path":"/forms/chromium/convert/html","referer":"","user_agent":"GotenbergSharpClient","status":500,"latency":2130956488,"latency_human":"2.130956488s","bytes_in":31122,"bytes_out":21}
gotenberg.pdfgenerator  | {"level":"error","ts":1708610315.3754623,"logger":"api","msg":"convert HTML to PDF: convert to PDF: handle tasks: print to PDF: Printing failed (-32000)","trace":"5005ad96-4120-4810-9b19-85d9ecfb03ed","remote_ip":"172.18.0.1","host":"localhost:3000","uri":"/forms/chromium/convert/html","method":"POST","path":"/forms/chromium/convert/html","referer":"","user_agent":"GotenbergSharpClient","status":500,"latency":2109998126,"latency_human":"2.109998126s","bytes_in":31122,"bytes_out":21}

when I look at the docker STATS (via docker desktop) it's using no more than 84mb. CPU 'jumps' to 10% or something small. There's 15gb allocated to the docker application (which I assume all containers can access).

The issue seems to be (i think) that I'm providing either/both a header and/or footer (along with a body).

The documentation states that the header/footer needs to be a complete HTML document:

image

So is there any way I could try and figure out what is going on?

I'm using the latest docker image so is there an Environmental variable I can set?

I'm trying the following:

  pdfgenerator:
    image: gotenberg/gotenberg:latest
    container_name: gotenberg.pdfgenerator
    ports:
      - "3000:3000"
    environment:
      - LOG_LEVEL=DEBUG
    networks:
      - backend

and I'm guessing that env var from the "version 6 docs" which mention something here.

I just don't think the issue is memory related to me :(

FINAL NOTE (not sure if this means anything): I'm using the C# client to call the docker image:

var pdfBuilder = new HtmlRequestBuilder()
    .AddDocument(doc => doc
        .SetHeader(headerHtml)
        .SetBody(bodyHtml)
        .SetFooter(footerHtml)
    )
    .WithDimensions(dimentions =>
    {
        dimentions
            .SetPaperSize(PaperSizes.A4)
            .SetMargins(Margins.Normal);
    });

var pdfRequest = await pdfBuilder.BuildAsync();

var pdfStream = await _pdfClient.HtmlToPdfAsync(pdfRequest, cancellationToken);

If I comment out the SetHeader and SetFooter everything works fine.

And yes .. if i copy the header HTML and footer HTML content into the body HTML (and just send the Body) then it works, also.

So before I bubble this question up to the C# client repo, I was hoping to do some more investigation on this level.

If you think this should be in a new issue, I can copy/paste this all into a new issue.

Thank you kindly! πŸ‘‹πŸ» 🍰

from gotenberg.

gulien avatar gulien commented on September 26, 2024

Hello @PureKrome,

I'm getting the same issue. My guess is that it's trying to go through all PDF modules and each one is giving an error:

No it's not, only the Chromium module exposes the route /forms/chromium/convert/html.

The issue seems to be (i think) that I'm providing either/both a header and/or footer (along with a body).

Gotenberg is using a default header / footer template if either the header or footer is set but not the other one.


Could you provide an example of header / footer that's causing an issue?

from gotenberg.

PureKrome avatar PureKrome commented on September 26, 2024

πŸ‘‹πŸ» G'day @gulien - really appreciate the reply (in a closed issue, none-the-less 😊 )

Could you provide an example of header / footer that's causing an issue?

Do you mean some sample html ? I'm not 100% sure (NDA's with private html content used to produce private PDF's). I know it's just a header/footer. I might be able to redact stuff, though.

also

  • what would be docker command line if i have the header.html, body.html and footer.html saved into files locally?
  • is there a docker env arg which would help expose more logging info?

Also to confirm -> the docs say that the header and footer need to be full HTML docs.
The link you provided for the default header/footer is:

image

which (to confirm) is what this is exactly doing?

from gotenberg.

gulien avatar gulien commented on September 26, 2024

I know it's just a header/footer. I might be able to redact stuff, though.

The idea is just to understand if there is something in the content for your header/footer that could explain your issue πŸ˜„

what would be docker command line if i have the header.html, body.html and footer.html saved into files locally?

No feasible IMO, at least for the header/footer. You could host the body in another webserver and uses the route /forms/chromium/convert/url to convert it though.

is there a docker env arg which would help expose more logging info?

No env var, but the flag --log-level=debug. Please checkout the documentation at https://gotenberg.dev, there is everything you need to know.

which (to confirm) is what this is exactly doing?

I'm not sure to understand. This is just a default HTML template to avoid the default one from Chromium that prints pages etc.

from gotenberg.

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.