Freeze when using a mode with apertium-anaphora
Closed this issue · 6 comments
When using a mode which includes apertium-anaphora
(such as eng>cat in apertium-eng-cat
) and calling it with /translate
, the request freezes and no response is given. This is only happening with /translate
, /pipedebug
is working as expected. The mode also works without issues outside of apertium-apy
.
apertium-anaphora
in theory has support for null-flush with -z, and it gives no issues outside of the API when used with the flag.
Adding apertium-anaphora
as an exception to make apertium-apy
call it without -z does not seem to change anything, the freeze is still there. In addition, removing apertium-anaphora
from the pipeline makes the mode work correctly.
Does anyone have a clue where the problem could be? @khannatanmai?
@marcriera I haven't really used apertium-apy
which is why I'm not sure why such a problem would occur. I've tested it extensively normally, including the -z mode.
Maybe someone who knows more about apertium-apy
can indicate why such a thing would happen and I can check if there's such a problem in the code. I'll ask on the irc as well.
In one terminal, I run
rm -f to from
mkfifo to from
< to \
lt-proc -z -w -e ../apertium-nno-nob/nob-nno.automorf.bin \
| cg-proc -z -w ../apertium-nno-nob/nob-nno.rlx.bin \
| apertium-tagger -z -g ../apertium-nno-nob/nob-nno.prob \
| apertium-pretransfer -z \
| lt-proc -z -b ../apertium-nno-nob/nob-nno.autobil.bin \
| lrx-proc -z -m ../apertium-nno-nob/nob-nno.autolex.bin \
> from & pid=$!
exec 3>to
exec 4<from
wait $pid
then in another, I do
exec 3>to
exec 4<from
printf 'ja.[]\0' >&3
awk 'BEGIN{RS="\0"}{printf "%s", $0;exit}' <&4
printf 'ja.[]\0' >&3
awk 'BEGIN{RS="\0"}{printf "%s", $0;exit}' <&4
and get the expected output ^ja<ij>/ja<ij>$[]
from both those awks.
However, if I now kill the jobs of that first terminal and re-do this with src/apertium-anaphora -z samples/apertium-eng-spa.spa-eng.arx
appended to that pipeline, ie.
rm -f to from
mkfifo to from
< to \
lt-proc -z -w -e ../apertium-nno-nob/nob-nno.automorf.bin \
| cg-proc -z -w ../apertium-nno-nob/nob-nno.rlx.bin \
| apertium-tagger -z -g ../apertium-nno-nob/nob-nno.prob \
| apertium-pretransfer -z \
| lt-proc -z -b ../apertium-nno-nob/nob-nno.autobil.bin \
| lrx-proc -z -m ../apertium-nno-nob/nob-nno.autolex.bin \
| src/apertium-anaphora -z samples/apertium-eng-spa.spa-eng.arx \
> from & pid=$!
exec 3>to
exec 4<from
wait $pid
jobs
and then try
exec 3>to
exec 4<from
printf 'ja.[]\0' >&3
awk 'BEGIN{RS="\0"}{printf "%s", $0;exit}' <&4
the awk hangs. There's a test case for you @khannatanmai :)
(nno-nob was just the pair I had at hand, feel free to change to eng-spa, just make sure you manage to reproduce the working pipeline first – you should be able to send many "requests" to it without it exiting)
Hey @unhammer I'm not able to reproduce this exactly. it works till the wait in the first terminal, but when I do exec 4<from
in the second terminal, it doesn't do anything and there's no prompt anymore.
(I'm not sure I understand this piping completely either so that might be it but I basically replaced all of it with eng-spa)
I believe this is fixed in 6741c60 – I'm able to use it as a daemon in the terminal as well as through apy. Could you check with newest git @marcriera ? (Or wait until tomorrow when you can probably update it through nightly packages)
Yup, works now.
I can also confirm that it now works correctly with apertium-apy
. Thanks a lot for the quick fix!