convert-to pdf hung

Platform: LibreOffice 6.0.4.2 on CentOS 6.x
I have some MS Word doc that I need to convert to PDF using libreoffice.
If I use the front end to do the export, the conversion completed without issue.
If I use command line (e.g. /usr/bin/libreoffice --headless --convert-to pdf infile.docx) the soffice.bin process get hang and 100% CPU. The PDF file did get generated correctly.
Note that it happens to only some files. So I suspect it might have something to do with the input file content.
So I guess my question is, are there some way I could debug it and narrow down what in the input file that causes the hanging?

@philip_c: first of all, please file a bug report. Make sure the issue is reproducible with fresh versions (6.1.4 or 6.2.0). Please attach a sample document to the issue.

To debug the issue, you need to build LibreOffice, and use debugger.

And please don’t use community wiki checkbox when posting questions. Thanks!