Skip to content

Fix Issue #2148: loadups fail on WSL1 with Xvnc server errors - fixed by adding new flag to medley script, use this flag in loadup script #2163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/man-page/man_medley.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ <h2>Flags</h2>
<p>On Windows/Cygwin installations, <em>FILE</em> is specified in the
Medley file system, not the host Windows file system.</p>
</dd>
<dt>-am, –automation</dt>
<dd>
<p>Useful only when using –vnc (and always on WSL1). When calling medley
as part of an automation script, often Medley will run for a very short
time (&lt; a couple of seconds). This can cause issues with medley code
that detects Xvnc server failures. Setting this flag notifies Medley
that very short Medley sessions are possible and the Xvnc error
detection needs to be adjusted accordingly.</p>
</dd>
</dl>
<h2>Other Options</h2>
<dl>
Expand Down
9 changes: 9 additions & 0 deletions docs/man-page/medley.1
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,15 @@ environment variable LDEREPEATCM.
On Windows/Cygwin installations, \f[I]FILE\f[R] is specified in the
Medley file system, not the host Windows file system.
.RE
.TP
-am, \[en]automation
Useful only when using \[en]vnc (and always on WSL1).
When calling medley as part of an automation script, often Medley will
run for a very short time (< a couple of seconds).
This can cause issues with medley code that detects Xvnc server
failures.
Setting this flag notifies Medley that very short Medley sessions are
possible and the Xvnc error detection needs to be adjusted accordingly.
.SS Other Options
.PP
\
Expand Down
Binary file modified docs/man-page/medley.1.gz
Binary file not shown.
9 changes: 7 additions & 2 deletions docs/man-page/medley.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ specified in the Medley file system, not the host Windows file system.
If the given value is "-", Medley will start up without using REM&#46;CM file.

There is no default Medley REM&#46;CM file.

On Windows/Cygwin installations, *FILE* is
specified in the Medley file system, not the host Windows file system.

Expand Down Expand Up @@ -254,10 +254,15 @@ for the parameter will be reset to the default value - which in the case of *Hos

-cc \[*FILE* | -], \-\-repeat \[*FILE* | -]
: Run Medley once. And then as long as *FILE* exists and is greater then zero length, repeatedly run Medley using *FILE* as the REM&#46;CM file that Medley reads and executes at startup. Each run of Medley can change the contents of *FILE* to effect the subsequent run of Medley. To end the cycle, Medley needs to delete *FILE*. WIthin Medley, *FILE* can be found as the value of the environment variable LDEREPEATCM.

On Windows/Cygwin installations, *FILE* is
specified in the Medley file system, not the host Windows file system.

-am, --automation
: Useful only when using --vnc (and always on WSL1). When calling medley as part of an automation script, often Medley
will run for a very short time (< a couple of seconds). This can cause issues with medley code that detects Xvnc server failures.
Setting this flag notifies Medley that very short Medley sessions are possible and the Xvnc error detection needs to be adjusted accordingly.


Other Options
-------------
Expand Down
68 changes: 53 additions & 15 deletions scripts/loadups/loadup
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ main() {
thinw=false
thinl=false
override_lock=false
ignore_lock=false
while [ "$#" -ne 0 ];
do
case "$1" in
Expand Down Expand Up @@ -148,9 +149,19 @@ main() {
-ov | -override | --override)
override_lock=true
;;
--ignore_lock)
# internal
ignore_lock=true
;;
--noendmsg)
# internal
noendmsg=true
;;
--forcevnc)
# internal - for testing
# WSL only -otherwise warning msg from medley
force_vnc="+"
;;
-z | -man | --man )
if [ "$(uname)" = "Darwin" ]
then
Expand Down Expand Up @@ -284,7 +295,7 @@ main() {
fi

#
# Do individual loadups as requested
# Do individual "stage" loadups as requested
#

if [ "${no_loadups}" = false ]
Expand Down Expand Up @@ -318,23 +329,11 @@ main() {
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-apps-from-full.sh"
exit_if_failure $? "${noendmsg}"
fi

if [ "${aux}" = true ]
then
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-aux.sh"
exit_if_failure $? "${noendmsg}"
fi

if [ "${db}" = true ]
then
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-db-from-full.sh"
exit_if_failure $? "${noendmsg}"
fi
fi


#
# Done with loadups, successfully. Now copy files into loadups dir from workdir
# Done with "stage" loadups, successfully. Now copy the stages files into loadups dir from workdir
#

if [ "${nocopy}" = false ]
Expand Down Expand Up @@ -371,7 +370,29 @@ main() {
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/apps.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
fi



#
# Now do the "after stages" loadups, if required. Do the copies as necessary to meet the dependecies
# of one loadup on another's output.
#

# First aux

if [ "${no_loadups}" = false ]
then

if [ "${aux}" = true ]
then
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-aux.sh"
exit_if_failure $? "${noendmsg}"
fi
fi

if [ "${nocopy}" = false ]
then
if [ "${aux}" = true ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/whereis.hash "${LOADUP_OUTDIR}" \
Expand All @@ -383,17 +404,34 @@ main() {
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/exports.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi
fi

# then db, which depends on the output of aux

if [ "${no_loadups}" = false ]
then
if [ "${db}" = true ]
then
/bin/sh "${LOADUP_SCRIPTDIR}/loadup-db-from-full.sh"
exit_if_failure $? "${noendmsg}"
fi
fi

if [ "${nocopy}" = false ]
then
if [ "${db}" = true ]
then
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.database "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
/bin/sh "${LOADUP_CPV}" "${LOADUP_WORKDIR}"/fuller.dribble "${LOADUP_OUTDIR}" \
| sed -e "s#${MEDLEYDIR}/##g"
fi

fi


#
# OK we're done, exit cleanly
#
echo "+++++ loadup: SUCCESS +++++"
remove_run_lock
exit 0
Expand Down
9 changes: 8 additions & 1 deletion scripts/loadups/loadup-aux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ main() {

loadup_start

SYSOUT="${LOADUP_OUTDIR}/full.sysout"
if [ ! -f "${SYSOUT}" ]
then
output_error_msg "Error: cannot find ${SYSOUT}.${EOL}Exiting."
exit 1
fi

initfile="-"
cat >"${cmfile}" <<-"EOF"
"
Expand All @@ -33,7 +40,7 @@ main() {
"
EOF

run_medley "${LOADUP_WORKDIR}/full.sysout"
run_medley "${SYSOUT}"

loadup_finish "whereis.hash" "whereis.hash" "exports.all"
}
Expand Down
12 changes: 10 additions & 2 deletions scripts/loadups/loadup-db-from-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ main() {

loadup_start

SYSOUT="${MEDLEYDIR}/loadups/full.sysout"
if [ ! -f "${SYSOUT}" ];
SYSOUT="${LOADUP_OUTDIR}/full.sysout"
if [ ! -f "${SYSOUT}" ]
then
output_error_msg "Error: cannot find ${SYSOUT}.${EOL}Exiting."
exit 1
fi

# Check to make sure exports.all exists and is newer than full.sysout
# if not, run loadup-aux to create a new exports.all
EXPORTS="${LOADUP_OUTDIR}/exports.all"
if [ ! -f "${EXPORTS}" ] || [ "$(find "${SYSOUT}" -newer "${EXPORTS}" -exec echo true \; )" = true ]
then
"${MEDLEYDIR}"/scripts/loadups/loadup --aux --ignore_lock --noendmsg
fi

initfile="-"
cat >"${cmfile}" <<-"EOF"
"
Expand Down
10 changes: 9 additions & 1 deletion scripts/loadups/loadup-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ loadup_finish () {
exit ${exit_code}
}

force_vnc="-"
run_medley () {
/bin/sh "${MEDLEYDIR}/scripts/medley/medley.command" \
--config - \
Expand All @@ -171,6 +172,8 @@ run_medley () {
--rem.cm "${cmfile}" \
--greet "${initfile}" \
--sysout "$1" \
--automation \
--vnc "${force_vnc}" \
"$2" "$3" "$4" "$5" "$6" "$7" ;
exit_code=$?
}
Expand Down Expand Up @@ -247,9 +250,13 @@ process_maikodir() {
}

export LOADUP_LOCKFILE="${LOADUP_WORKDIR}"/lock
LOADUP_LOCK=""
override_lock=false
ignore_lock=false

check_run_lock() {
set +x
if [ "${ignore_lock}" = false ]
then
if [ -e "${LOADUP_LOCKFILE}" ]
then
output_warn_msg "Warning: Another loadup is already running with PID $(cat "${LOADUP_LOCKFILE}")"
Expand Down Expand Up @@ -282,6 +289,7 @@ check_run_lock() {
fi
echo "$$" > "${LOADUP_LOCKFILE}"
LOADUP_LOCK="$$"
fi
}

remove_run_lock() {
Expand Down
8 changes: 7 additions & 1 deletion scripts/medley/medley.command
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ flags:

-x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley

-am | --automation : this call to medley is being used in automation, adjust timings. Relevant in -vnc case only.

-cm FILE | --rem.cm FILE : use FILE as the REM.CM when starting up Medley. FILE must be absolute pathname.

-cm - | --rem.cm - : do not use an REM.CM. Negate any prior setting, e.g., from config file.
Expand Down Expand Up @@ -638,6 +640,7 @@ pixelscale_arg=""
borderwidth_arg=""
remcm_arg="${LDEREMCM}"
repeat_cm=""
automation=false

# Add marker at end of args so we can accumulate pass-on args in args array
set -- "$@" "--start_of_pass_args"
Expand Down Expand Up @@ -915,6 +918,9 @@ do
fi
exit 0
;;
-am | --automation)
automation=true
;;
-nf | -NF | --nofork)
# for use in loadups
case $2 in
Expand Down Expand Up @@ -1702,7 +1708,7 @@ do
"$(ip_addr)":"${VNC_PORT}" \
>>"${LOG}" 2>&1 &
wait $!
if [ $(( $(date +%s) - start_time )) -lt 5 ]
if [ "${automation}" = false ] && [ $(( $(date +%s) - start_time )) -lt 5 ]
then
if [ -z "$(pgrep -f "Xvnc ${DISPLAY}")" ]
then
Expand Down
4 changes: 4 additions & 0 deletions scripts/medley/medley_args.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pixelscale_arg=""
borderwidth_arg=""
remcm_arg="${LDEREMCM}"
repeat_cm=""
automation=false

# Add marker at end of args so we can accumulate pass-on args in args array
set -- "$@" "--start_of_pass_args"
Expand Down Expand Up @@ -325,6 +326,9 @@ do
fi
exit 0
;;
-am | --automation)
automation=true
;;
-nf | -NF | --nofork)
# for use in loadups
case $2 in
Expand Down
2 changes: 2 additions & 0 deletions scripts/medley/medley_usage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ flags:

-x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley

-am | --automation : this call to medley is being used in automation, adjust timings. Relevant in -vnc case only.

-cm FILE | --rem.cm FILE : use FILE as the REM.CM when starting up Medley. FILE must be absolute pathname.

-cm - | --rem.cm - : do not use an REM.CM. Negate any prior setting, e.g., from config file.
Expand Down
2 changes: 1 addition & 1 deletion scripts/medley/medley_vnc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
"$(ip_addr)":"${VNC_PORT}" \
>>"${LOG}" 2>&1 &
wait $!
if [ $(( $(date +%s) - start_time )) -lt 5 ]
if [ "${automation}" = false ] && [ $(( $(date +%s) - start_time )) -lt 5 ]
then
if [ -z "$(pgrep -f "Xvnc ${DISPLAY}")" ]
then
Expand Down