<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body style="word-wrap:break-word" vlink="#954F72" link="#0563C1"
lang="DE">
<p>Hello everybody,</p>
<p>I would like to execute a server side script from within a topaz
job using System performOnServer:. What I do is basically this: <br>
</p>
<div class="moz-forward-container">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Courier
New""><br>
</span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">#!/bin/bash<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#This is Script:
testLongRunningPerformOnServer.sh<o:p></o:p></span></p>
<span style="font-family:"Courier New"">/opt/gemstone/gemstone/bin/topaz
-l << EOF<o:p></o:p></span>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">set gems mystone user seaside pass
swordfish<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">login<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">run<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">%<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">iferror exit<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">time<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">run<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| resultString |<o:p></o:p></span></p>
<span style="font-family:"Courier New"" lang="EN-US"><o:p> </o:p></span>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">"Switch to transactionless while
running the external task"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">System transactionMode:
#transactionless.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">resultString := System
performOnServer: 'sleepForSeconds 3600'.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">"Aquire database view again in order
to save the result to the repository"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">System transactionMode: #autoBegin.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">MyApplication persistResult:
resultString.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">System commitTransaction.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">^'done'.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">%<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">time<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">logout<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">exit<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">EOF<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
</div>
<div class="WordSection1">For testing I wrote this dummy-script:<br>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">#!/bin/bash<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"># This is Script: sleepForSeconds<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"># ramauers, 2022-01-28: Print out
some text and sleep for the number of seconds given as 1st
argument.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">if [ A$1 = A ]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">then<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> echo "number of seconds to
sleep expected as 1st argument"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> exit 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">fi<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">seconds=1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">while [ $seconds -le $1 ]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">do<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> sleep 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> date<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> echo "Sleeping since
$seconds/$1 seconds."<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">
</span><span style="font-family:"Courier New"">((seconds++))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">done<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
This works in principle, but it reproducibly fails with the
following exception, if other sessions are doing a lot of
commits while the external script is executing.<br>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<span style="font-family:"Courier New"" lang="EN-US">_____________________________________________________________________________<o:p></o:p></span>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| GemStone/S64
Object-Oriented Data Management System |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| Copyright (C)
GemTalk Systems 1986-2016 |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| All
rights reserved. |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| covered by Patent Number
6,567,905 Generational Garbage Collector. |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">+-----------------------------------------------------------------------------+<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| PROGRAM: topaz, Linear GemStone
Interface (Linked Session) |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| VERSION: 2.4.8, Tue Feb 2
15:18:28 2016 |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| BUILD:
gss64_2_4_x_branch-38672
|<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| BUILT FOR: x86-64
(Linux) |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| MODE: 64
bit
|<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| RUNNING ON: 2-CPU myhost... x86_64
(Linux 3.10.0-1160.42.2.el7.x86_64<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| #1 SMP Tue Aug 31 20:15:00 UTC
2021) 3906MB |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| PROCESS ID: 115117 DATE:
02/23/2022 08:35:26 CET |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">| USER IDS: REAL=ramauers (25250)
EFFECTIVE=ramauers (25250) |<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">|_____________________________________________________________________________|<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">topaz> topaz> [Info]: LNK
client/gem GCI levels = 844/844<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[Info]: User ID: seaside<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[Info]: Repository: mystone<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[Info]: Session ID: 2<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[Info]: GCI Client Host:
<Linked><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[Info]: Page server PID: -1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[Info]: Login Time: 02/23/2022
08:35:26 CET<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[Info]: Extended character table
loaded<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[02/23/2022 08:35:26 CET] gci login:
currSession 1 rpc gem processId -1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">successful login<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">topaz 1> nil<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">topaz 1> topaz 1> 02/23/2022
08:35:26 CETCPU time: 0.110 seconds<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">topaz 1><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">[Info]: Logging out at 02/23/2022
09:35:38 CET<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">-----------------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">GemStone: Error Fatal<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">The GemStone session has lost its
connection to the Stone Repository<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">monitor.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">Error Category: [GemStone] Number:
4035 Arg Count: 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US">Now executing the following command
saved from "iferr 1":<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"" lang="EN-US"> </span>
<span style="font-family:"Courier New"">exit<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
The exception occures immediately after the called script
regularly finished. Due to the case, that it only fails in
conjunction with a lot of commits, I suppose that this is
somehow related to sent sigAborts from the stone, although I
would not expect any issues with that while the session is in
transactionless-Mode. I also fiddled around with
sigAbort-Handlers, but was unable to solve this issue so far.</div>
<div class="WordSection1"><br>
</div>
<div class="WordSection1">Any ideas are very much appreciated.</div>
<div class="WordSection1"><br>
</div>
<div class="WordSection1">Best regards,</div>
<div class="WordSection1">Ralph<br>
</div>
</div>
</body>
</html>