mark_h
31st July 2018, 22:13
I have a piece of code that it appears it errors n the shell command. The reason I think this since the tempfile I create is still out there. Now the users say it happens everytime, but I can only find one error out there right now. I am still trying to figure out if that is the case, but thought I would see if anyone on the board might now of something I can check.


cmd = "mailx -s " & chr$(34) &"Project " & strip$(mail.cprj) & chr$(34)& " " & strip$(mail.addr) & "<" & temp.file
rc = shell(cmd, SHELL_NO_OUTPUT)
rc = seq.unlink(temp.file)


log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: Log message called from /view/pset9.1c.nlbaucc.ccadm.snapshot/vobs/tt/lib/al_1/al_log.c: #1211 keyword: stack trace
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: Pid 8220 Uid 4222 Euid 4222 Gid 125 Egid 125 Pset someuser@somehost:16776
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: user_type N language 2 user_name someuser locale ISO88591/NULL package_comb B40C_prd
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: session: "ottstpstdlib ";object: "ottstpstdlib"; function: "<1>" ; company number: 0
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: Errno 2 (No such file or directory) bdb_errno 213 (Transaction is started but not updated)
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 8220: bshell ([someuser]@somehost:16776/SOCKET<someuser@some.hold:16776>)
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: ffffffff7de4edfc waitid (0, 219d, ffffffff7ffdc020, 3)
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: ffffffff7de1e498 system (ffffffff7ffdc380, 1b8, ffffffff7ffdc1d8, ffffffff7df8a000, 0, ffffffff7ffdc1fc) + 2d4
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 000000010020fc08 create_stack_trace (100c00, 1, 100d6dc88, 100d6d000, 100d6d, 100bed8b8) + b8
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 000000010020f9e4 log_stack_trace (0, 100bf6, 100fc04d0, 100d73, 100800, 4) + 4
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 0000000100241fd0 do_emergency (0, 100d71000, 100df5000, 1, 100df5, 100c00) + 30
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 0000000100575184 detach_client (0, 100575290, 222, 0, 100fc04f0, 100fc0450) + 34
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 0000000100573b64 fd_read (100fc03d0, 1019c8a70, 1000, 6, 100fc03d0, ffffffffffffffff) + 144
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 000000010024dbb0 sread_blok (ffffffff7ffdccde, 2, 100fc0450, 2, 0, 1019c8a70) + 270
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 00000001002aa17c DsReadMessageNumber (5b5f7d7d, 1, ffffffff7c7004b0, 100f3c000, 100f3c, 100f3c780) + 1c
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 000000010029e098 DsReadInput (0, 1, ffffffff7ffdcd94, 100d75db8, 100c00, 1) + 88
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 0000000100126b9c schedule (0, 0, 100f3b770, 100dd4838, 20000, 100c00) + 52c
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 0000000100055544 baan_cpu (100e38000, fffffffffffffffd, 0, 0, 100c00, 100e38000) + 1c7a4
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 00000001000cdca8 main (0, 100c00, 4000, 100e38, 100e38000, 100f3b) + 1ef8
log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: 000000010000c108 _start (0, 0, 0, 0, 0, 100d44de0) + 108

NPRao
1st August 2018, 02:12
rc = shell(cmd, SHELL_NO_OUTPUT)
rc = seq.unlink(temp.file)

log.bshell:2018-07-30[16:05:01(UTC+00:00)]:E:someuser: Errno 2 (No such file or directory) bdb_errno 213 (Transaction is started but not updated)

I think there is a conflict that the mailx has not finished executing and the seq.unlink() is called to delete the file.
Since there is no option like SHELL_WAIT for the shell() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_starting_and_stopping_programs_shell), you can try to debug adding - SHELL_MWINDOW to your code.

SHELL_NO_WAIT : The shell function does not wait for the emulator to end. This is useful for starting shell processes (such as an editor) while continuing processing. The variable shell.pid is set to the process number of the activated terminal emulator process. A new main window is created.
SHELL_NO_OUTPUT : The terminal emulator does produce any output. This implies the SHELL_NO_MWINDOW option.
SHELL_MWINDOW : A main window is created. This displays the output of the shell command.

-OR-

Change the code to use the run.prog() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_starting_and_stopping_programs_run_baan_prog_run_prog) since shell() is deprecated.

Deprecated. This function is supported for backward compatibility only. In new applications, use run.prog() and run.baan.prog() instead.

My code worked for a while, before I ported email interface to the CMF & SMTP options.
comd = "/bin/mailx"
if not isspace(subject) then
args = " -s " & quoted.string(trim$(subject)) & " " & email.addr
else
args = email.addr
endif
ret = run.prog(comd, args, RP_WAIT, trim$(file.path))

mark_h
1st August 2018, 17:41
Thanks NPR. I will try to look at some of the option. The more I look at this the more it seems it was a one off situation. With about 4 months to go until we convert to oracle I might just toss a pause in for a couple of seconds see that helps. Then if a worse case scenario I will look at run prog.