<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Headless Writer conversion to PDF consumes is stuck at 100% CPU usage"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=124798">124798</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Headless Writer conversion to PDF consumes is stuck at 100% CPU usage
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.2.2.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Writer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>documentfoundation@goeddel.net
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
We are developing a software which create ODT files and then uses lowriter to
convert the file to PDF.

For some reason this is not working with every document we are giving to
writer. It seems to work with some documents but not with others. However, it
always works when opening the ODT using the UI and then press the "Export to
PDF" button.

Steps to Reproduce:
There are two versions to reproduce this bug:
A) Using convert-to:
1. Save the ODT file stored as attachment to this bug report on your harddrive,
say to /tmp/failure.odt
2. Start the following command in the terminal:
lowriter --headless --convert-to pdf:writer_pdf_Export --outdir /tmp
/tmp/failure.odt
3. While the process is running look into htop or a similar utility to see that
soffice.bin shows 100% CPU usage and never stops to do that.
4. Wait some minutes or longer if you want to, but even after an hour it will
not stop. You can kill it now.

B) Using a macro:
1. Save the ODT file stored as attachment to this bug report on your harddrive,
say to /tmp/failure.odt
2. Create a new Module in the Standard library, e.g. Module1 and write a simple
script to create a PDF:

REM =========================
Sub Main(Optional filename As String)

        Dim storeChanges as Boolean

        If IsMissing(filename) Then
                document = ThisComponent
                filename = ConvertToURL("/tmp/failure.odt")
                storeChanges = False
        Else
                document =
StarDesktop.loadComponentFromURL(ConvertToURL(filename), "_blank", 0, Array())
                storeChanges = True
        End If

        dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

        'Export to PDF
        dim args1(1) as new com.sun.star.beans.PropertyValue
        args1(0).Name = "URL"
        args1(0).Value = filename + ".pdf"
        args1(1).Name = "FilterName"
        args1(1).Value = "writer_pdf_Export"

        msgbox(args1(0).Value)

        dispatcher.executeDispatch(document.CurrentController.Frame,
".uno:ExportDirectToPDF", "", 0, args1())

        If storeChanges Then
                document.store()
                document.close(True)
        End If

End Sub
REM ==================================
3. Close Writer and every other office process.
4. Call the following command from the terminal:
lowriter --headless "macro:///Standard.Module1.Main(\"/tmp/failure.odt\")"
5. While the process is running look into htop or a similar utility to see that
soffice.bin shows 100% CPU usage and never stops to do that.
6. Wait some minutes or longer if you want to, but even after an hour it will
not stop. You can kill it now.

Actual Results:
Just 100% CPU usage and no result.

Expected Results:
A nice PDF within seconds.


Reproducible: Always


User Profile Reset: No



Additional Info:
It may have to do with embedded graphics. It seems to work when the attribute
svg:height or svg:width of <draw:frame> has a lower value or no value. Maybe
there is something going in an infinite loop while layouting these frames which
does not go in a loop when using the UI.

Version: 6.2.2.2
Build-ID: 1:6.2.2-0ubuntu0.18.04.1~lo1
CPU-Threads: 8; BS: Linux 4.4; UI-Render: Standard; VCL: gtk3; 
Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE
Calc: threaded</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>