vladholubiev / serverless-libreoffice

Run LibreOffice in AWS Lambda to create PDFs & convert documents
https://vladholubiev.com/serverless-libreoffice
513 stars 75 forks source link

Terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException' #8

Open ChiefConversion opened 6 years ago

ChiefConversion commented 6 years ago

Hello, Firstly, thanks for sharing your code, it's a great help.

I'm currently setting up your scripts and more particularly LibreOffice on AWS lambda. However, when I want to execute soffice command to convert a document I have the following error:

_ { Error: Command failed: cd /tmp && ./instdir/program/soffice --headless --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --norestore --convert-to pdf --outdir /tmp/ fileTest

terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException' terminate called recursively

Fatal exception: Signal 6 Stack: /tmp/instdir/program/libuno_sal.so.3(+0x3ca00)[0x7ff76c8eba00] /tmp/instdir/program/libuno_sal.so.3(+0x3cb70)[0x7ff76c8ebb70] /lib64/libc.so.6(+0x35270)[0x7ff76c520270] /lib64/libc.so.6(gsignal+0x37)[0x7ff76c5201f7] /lib64/libc.so.6(abort+0x148)[0x7ff76c5218e8] /var/lang/lib/libstdc++.so.6(_ZN9gnu_cxx27verbose_terminate_handlerEv+0xed)[0x7ff765a8faed] /var/lang/lib/libstdc++.so.6(+0x5daf6)[0x7ff765a8daf6] /var/lang/lib/libstdc++.so.6(+0x5c6b9)[0x7ff765a8c6b9] /var/lang/lib/libstdc++.so.6(gxx_personality_v0+0xd2)[0x7ff765a8cd82] /var/lang/lib/libgcc_s.so.1(+0x10070)[0x7ff765829070] /var/lang/lib/libgcc_s.so.1(_Unwind_Resume+0x59)[0x7ff7658296f9] /tmp/instdir/program/libmergedlo.so(+0x2ef3cb1)[0x7ff76fa00cb1] /tmp/instdir/program/libuno_sal.so.3(+0x16c62)[0x7ff76c8c5c62] /tmp/instdir/program/libuno_sal.so.3(+0x3cb2f)[0x7ff76c8ebb2f] /lib64/libc.so.6(+0x35270)[0x7ff76c520270] /lib64/libc.so.6(gsignal+0x37)[0x7ff76c5201f7] /lib64/libc.so.6(abort+0x148)[0x7ff76c5218e8] /var/lang/lib/libstdc++.so.6(_ZN9gnu_cxx27verbose_terminate_handlerEv+0x15d)[0x7ff765a8fb5d] /var/lang/lib/libstdc++.so.6(+0x5daf6)[0x7ff765a8daf6] /var/lang/lib/libstdc++.so.6(+0x5db41)[0x7ff765a8db41] /var/lang/lib/libstdc++.so.6(cxa_rethrow+0x46)[0x7ff765a8ddd6] /tmp/instdir/program/libmergedlo.so(_ZN12SvtSysLocaleC1Ev+0x33b)[0x7ff76f6d56db] /tmp/instdir/program/libmergedlo.so(+0x1407a7b)[0x7ff76df14a7b] /tmp/instdir/program/libmergedlo.so(+0x1eb9983)[0x7ff76e9c6983] /tmp/instdir/program/libmergedlo.so(+0x1ec0359)[0x7ff76e9cd359] /tmp/instdir/program/libmergedlo.so(+0x2ef54b6)[0x7ff76fa024b6] /tmp/instdir/program/libmergedlo.so(_Z6SVMainv+0x22)[0x7ff76fa025a2] /tmp/instdir/program/libmergedlo.so(soffice_main+0x8a)[0x7ff76e9ed54a] /tmp/instdir/program/soffice.bin[0x4006eb] /lib64/libc.so.6(__libc_startmain+0xf5)[0x7ff76c50cc05] /tmp/instdir/program/soffice.bin[0x400721]

Do you have any idea? It seems that the lo.tar.gz contains a binary file that AWS lambda can't open. I tried to do the same thing on MAC OSX, and I have the following error:

./instdir/program/soffice: line 174: AWS/instdir/program/oosplash: cannot execute binary file ./instdir/program/soffice: line 174: AWS/instdir/program/oosplash: Undefined error: 0

I checked and this oosplash is present in the directory, I tried to change the permissions but it didn't work. By the way, I don't have this issue when I use the standard LibreOffice distribution.

vladholubiev commented 6 years ago

@ChiefConversion this binary won't run on macOS X, it's compiled for Amazon Linux

This looks like a problem with your file. What format is it? From your logs looks like this file is without extension.

ChiefConversion commented 6 years ago

It was a .txt file. However, I noticed something when I installed your packages on an Amazon Linux VM, and I tried to convert a document and I still have the same issue. For example, if I try to run " ./instdir/program/soffice ", I have exactly the same issue. So I don't think that the issue is the format. I changed the format to txt, and I have the same result.

vladholubiev commented 6 years ago

@ChiefConversion do you mind sharing that .txt file you tried? It's hard to help otherwise

ChiefConversion commented 6 years ago

I tried several txt files for example, I just wrote 'Hello World' in the txt file, or I used this one https://github.com/vladgolubev/serverless-libreoffice/blob/master/src/libreoffice.js that I converted to .txt before. Just to be sure about the lambda process, right now when I have a AWS lambda call, I upload lo.tar.gz from my S3 bucket (which contains your LibreOffice executable) that I store in the /tmp/ directory. Then I use the following command to "unzip" it, "tar -xvzf lo.tar.gz", and then I can download my txt file to convert it.

vladholubiev commented 6 years ago

@ChiefConversion hmmmmm, are you using node.js Lambda environment? Or another language? That's the only thing which comes to my mind which may cause code behave differently in my and yours Lambda.

Also, did you try the latest compiled version? Either way, did you try previous/next version from here https://github.com/vladgolubev/serverless-libreoffice/releases ?

ChiefConversion commented 6 years ago

Yes, I'm using node.js Lambda environment (8.10). Supposing the error comes from AWS lambda, I tried to run the conversion on Amazon Linux VM, and I have the same issue. So I don't think that the issue is with AWS Lambda and its environment. I also tried all the lo.tar.gz available on this page https://github.com/vladgolubev/serverless-libreoffice/releases

abridger21 commented 6 years ago

I'm having a similar issue trying to run LibreOffice in Lambda. It only seems to surface running under load. I know this is an older thread, but wondering if you ever figured out a solution?

Hru28 commented 5 years ago

I am running into the same issue. I have easier repro steps. Download LibreOffice-6.1 https://github.com/vladgolubev/serverless-libreoffice/releases. Decompress and compress using tar on Mac without making any changes. Test with the new compressed file in Lambda. The original downloaded file works but the one compressed on Mac does not.

mrvisser commented 4 years ago

Same here, running the compile.sh on a Lambda AMI, the resulting soffice binary on the CentOS machine gives the above error. That's for 6.2.1.2.

randombluff commented 4 years ago

I got such errors a few times while tried to run build and tests for amazon linux 2. Uno library exceptions are mostly caused in context of the incorrect build and run platforms. If you built in let's say Amazon Linux 1 and then trying to run the code on Amazon Linux 1 that differs from the first one, mostly if there where not the same dependencies, .so files, or they were compiled with other gcc it can cause this kind of issue, even broken softlink is possible. Try to make compile environment as close to the runtime as you can. Also, you can check here(https://languagetool.org/issues) ^_^