550 The semaphore timeout period has expired

Discussions related to FTPAPI (An FTP client package for RPG programming.) http://www.scottklement.com/ftpapi/
Post Reply
peder udesen
Posts: 15
Joined: Thu Jul 29, 2021 8:00 am

550 The semaphore timeout period has expired

Post by peder udesen »

I have a program that copies files from a FTP server to our local "AS/400" ( choose the name you prefer ).
Then it creates a mail with the files attached and sends it.

It has worked without problems for years.
A couple of years ago the FTP server was moved from our local site to a server in another country.

Yesterday I was called by a user who complained that some files that should have been attached to the mail
was missing. I made a test and indeed it only found 1 of 2 files. Repeating it a couple of times with the same
example both files where suddenly found and copied to the AS/400.
The files have been present on the FTP server since January -- so it couldn't be a user that have saved it there
between the tests.

Checking the joblog I found this weird message:
550 The semaphore timeout period has expired
I have attached a file with the message.

I tried to google it and found this
https://recoverit.wondershare.com/compu ... error.html
But none of the suggestions of the cause made sense to me.

The FTPAPI source is version 2.2 and OS/400 is V7R3.

So what can be done to avoid having this error ?
Or catch it for a number of retries?


EDIT: I have added the file referred. I don't know why it was missing.
Attachments
semaphore1.jpg
semaphore1.jpg (36.19 KiB) Viewed 26698 times
Last edited by peder udesen on Thu Jul 20, 2023 9:51 am, edited 1 time in total.
vhamberg
Posts: 15
Joined: Thu Jul 29, 2021 1:33 am

Re: 550 The semaphore timeout period has expired

Post by vhamberg »

As I recall, functions in FTP_API return error information - ftp_get certainly does. This is an example from EX3GET -

if ftp_get(ftp: 'fips.exe': '/fips.exe') < 0

The parameter ftp has the code, and you can get the message.

So I would use that parameter to catch the error.

Hope this helps with your question.

Vern
vhamberg
Posts: 15
Joined: Thu Jul 29, 2021 1:33 am

Re: 550 The semaphore timeout period has expired

Post by vhamberg »

Correction to my post - the ftp variable is the connection - but you can get the error message if the result of calling ftp_get is less than 0.
Scott Klement
Site Admin
Posts: 732
Joined: Sun Jul 04, 2021 5:12 am

Re: 550 The semaphore timeout period has expired

Post by Scott Klement »

Hello Peder,

A semaphore is a programming tool that's used to synchronize actions. Think of it as being like a "lock on a record", that prevents two programs from updating a record at the same time. One program uses the semaphore to denote that it is using a resource (for example, data in memory) and a second program waits for that first program to be done before doing it's work.

It is very similar to a mutex, except that semaphores can be used across jobs -- whereas a mutex is typically only available within a given job.

What this message is telling you is that the FTP server encountered an error... it timed out waiting for a semaphore.

This isn't a problem with FTPAPI -- in fact, it isn't related to FTPAPI at all -- the server is timing out waiting for something, so it can't carry out the action you requested. So it reports an error to FTPAPI, which in turn, is relaying the error to your program.

You will need to ask whomever is running the server to look into the problem and fix it. (If I had to guess, I'd guess the server is trying to handle too many requests at once and can't keep up -- but this is only a guess, I don't know anything about the server software or how it works aside from what the message says.)
peder udesen
Posts: 15
Joined: Thu Jul 29, 2021 8:00 am

Re: 550 The semaphore timeout period has expired

Post by peder udesen »

Thank you very much for your thorough explanation.

I will show it to one of my local Infrastructure colleagues and have a discussion
with him if it is a solution to raise a ticket for our global organization.

If it can not be solved there, should I check for an error message containing
"550", "semaphore" and "timeout" and if it occurs wait 2 seconds and retry to get the file?
Or am I risking to have a lot of problems?
peder udesen
Posts: 15
Joined: Thu Jul 29, 2021 8:00 am

Re: 550 The semaphore timeout period has expired

Post by peder udesen »

If I monitor for an error message containing "550", "semaphore" and "timeout"
as described before do you think it will cause problems?
Scott Klement
Site Admin
Posts: 732
Joined: Sun Jul 04, 2021 5:12 am

Re: 550 The semaphore timeout period has expired

Post by Scott Klement »

It won't cause problems for me... will it cause problems for the server, I don't know?
peder udesen
Posts: 15
Joined: Thu Jul 29, 2021 8:00 am

Re: 550 The semaphore timeout period has expired

Post by peder udesen »

Thank you very much.

I will let it check for this error and retry every 2 seconds.
Post Reply