Apache OpenOffice (AOO) Bugzilla – Issue 25686
MailMerge.OutputType=PRINTER hangs OOo on Linux
Last modified: 2013-08-07 14:41:36 UTC
In OpenOffice Basic on a Linux system, MailMerge.Execute() with OutputType=com.sun.star.text.MailMergeType.PRINTER hangs OOo on attempting to exit; whereas when run with OutputType set to com.sun.star.text.MailMergeType.FILE, the program exits fine. Note: The mail merge itself runs perfectly fine and outputs to the printer without a problem, it's just that "soffice" does not ever exit and needs to be send a SIGTERM to quit. And here's the kicker... if I run a copy of OOo from the command line (in the background or invoked from another shell: e.g. "soffice &"), then the invocation of soffice running the macro DOES exit, and I can still exit the first soffice invocation without a problem... I hope this fact provides a clue as to what might be going wrong. The following code snippet is the core of what is used. I'll post the whole program as an attachment in a follow on. oDbContext = CreateUnoService("com.sun.star.sdb.DatabaseContext") oDbInstance = oDbContext.createInstance() oDbContext.registerObject(sDbName, oDbInstance) oDbInstance.URL = "sdbc:flat:" + aDbURL.Protocol + aDbURL.Path oMailMerge = CreateUnoService("com.sun.star.text.MailMerge") oMailMerge.DataSourceName = sDbName oMailMerge.DocumentURL = aDocURL.Main oMailMerge.CommandType = com.sun.star.sdb.CommandType.TABLE oMailMerge.Command = sDbName oMailMerge.OutputType = com.sun.star.text.MailMergeType.PRINTER oMailMerge.SinglePrintJobs = False ' Set the default, just in case... oDbInstance.setPropertyValue("Info", mDbProperties()) oDbConnection = oDbInstance.getConnection("", "") oMailMerge.ActiveConnection = oDbConnection Dim w() As com.sun.star.beans.NamedValue ' Empty placeholder for invocation oMailMerge.execute(w) When I run the exact same code, but with MailMerge.OutputType=com.sun.star.text.MailMergeType.FILE, it exits fine after completing: When it's hung, there are several soffices instantiated, e.g. (ps af): 7268 pts/0 S 0:07 \_ /usr/local/OO/program/soffice.bin [...] 7288 pts/0 S 0:00 \_ /usr/local/OO/program/soffice.bin [...] 7289 pts/0 S 0:00 \_ /usr/local/OO/program/soffice.bin [...] 7291 pts/0 S 0:00 \_ /usr/local/OO/program/soffice.bin [...] 7292 pts/0 S 0:00 \_ /usr/local/OO/program/soffice.bin [...] 7299 pts/0 S 0:00 \_ /usr/local/OO/program/soffice.bin [...] Is there any instance of soffice.bin that I can give debug information on that would be particularly useful? They are variously waiting on pipes (a read of which returns EAGAIN) and writing to other pipes. I can provide detailed system call trace information if that would help figure out what was going on. N.B. This issue is similar to another one reported for Solaris (Issue #23426), but it doesn't actually crash on Linux, it just hangs... and it exhibits the behaviour discussed above when there is already a copy of soffice running.
Created attachment 13290 [details] Basic macro for reproducing observed behaviour
Created attachment 13291 [details] Simple merge document with fields
Created attachment 13292 [details] Simple data source for merge
I invoke the macros from the command line thusly (on the provided sample files, with the provided macros): soffice "macro:///Medformix.FlatMerge.File(file:///home/jbotte/Projects/Open Office/PasswdTest.sxw, file:///home/jbotte/Projects/Open Office/PasswdTest.csv?FieldDelimiter=%3A, file:///home/jbotte/Projects/Open Office/, UserName)" soffice "macro:///Medformix.FlatMerge.Printer(file:///home/jbotte/Projects/Open Office/PasswdTest.sxw, file:///home/jbotte/Projects/Open Office/PasswdTest.csv?FieldDelimiter=%3A)"
HI->TL: According to OS this is your area.
.
Created attachment 19132 [details] modified macro to work in OOo 2.0
Created attachment 19133 [details] Modified .csv - file uses ';' as separator
It is not system dependent. Fixed in cws os42 in sw/inc/dbmgr.hxx sw/source/ui/dbui/dbmgr.cxx and sw/source/ui/uno/unomailmerge.cxx
The modified macro can also be called using soffice "macro:///Standard.Module1.Main"
Verified together with OS = ok
Verified with 680m65 = ok