Issue 25686 - MailMerge.OutputType=PRINTER hangs OOo on Linux
Summary: MailMerge.OutputType=PRINTER hangs OOo on Linux
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: OOo 1.1
Hardware: PC All
: P2 Trivial (vote)
Target Milestone: ---
Assignee: h.ilter
QA Contact: issues@sw
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-19 14:43 UTC by jbotte
Modified: 2013-08-07 14:41 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Basic macro for reproducing observed behaviour (48.10 KB, text/plain)
2004-02-19 14:58 UTC, jbotte
no flags Details
Simple merge document with fields (5.37 KB, application/vnd.sun.xml.writer)
2004-02-19 14:59 UTC, jbotte
no flags Details
Simple data source for merge (152 bytes, text/plain)
2004-02-19 14:59 UTC, jbotte
no flags Details
modified macro to work in OOo 2.0 (68.66 KB, text/plain)
2004-11-09 15:41 UTC, Oliver Specht
no flags Details
Modified .csv - file uses ';' as separator (152 bytes, text/encoded)
2004-11-09 15:42 UTC, Oliver Specht
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description jbotte 2004-02-19 14:43:00 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.
Comment 1 jbotte 2004-02-19 14:58:16 UTC
Created attachment 13290 [details]
Basic macro for reproducing observed behaviour
Comment 2 jbotte 2004-02-19 14:59:10 UTC
Created attachment 13291 [details]
Simple merge document with fields
Comment 3 jbotte 2004-02-19 14:59:38 UTC
Created attachment 13292 [details]
Simple data source for merge
Comment 4 jbotte 2004-02-19 15:02:53 UTC
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)"

Comment 5 h.ilter 2004-03-02 13:16:43 UTC
HI->TL: According to OS this is your area.
Comment 6 thomas.lange 2004-03-08 12:00:02 UTC
.
Comment 7 Oliver Specht 2004-11-09 13:13:04 UTC
.
Comment 8 Oliver Specht 2004-11-09 15:41:33 UTC
Created attachment 19132 [details]
modified macro to work in OOo 2.0
Comment 9 Oliver Specht 2004-11-09 15:42:52 UTC
Created attachment 19133 [details]
Modified .csv - file uses ';' as separator
Comment 10 Oliver Specht 2004-11-09 15:51:39 UTC
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 

Comment 11 Oliver Specht 2004-11-15 11:57:45 UTC
The modified macro can also be called using 
soffice "macro:///Standard.Module1.Main"

Comment 12 Oliver Specht 2004-11-15 11:58:18 UTC
.
Comment 13 Oliver Specht 2004-11-15 12:00:27 UTC
.
Comment 14 h.ilter 2004-11-17 13:49:31 UTC
Verified together with OS  =  ok
Comment 15 h.ilter 2004-12-07 09:37:56 UTC
Verified with 680m65 = ok