This problem went away for a few days, but restarted a couple of nights ago. It 
still happens at 3am. I have not been able to observe what happens at that time 
and suspect that if I try I won't see the problem. I suspect that Apple's 
evolving power management features are part of the problem and that if a user 
were interacting with the system at 3am, we wouldn't see this because the 
system would not be idle. Spending the night on site, which is an hour away, 
isn't an option, nor is getting up in the middle of the night and remotely 
logging in in the hope I can observe an obvious problem.

I believe I've done everything I can using the pmset command to prevent sleep, 
standby etc. It isn't clear if you can totally turn power management off 
everywhere though. In researching this problem I also discovered the 
'caffeinate' command. This is a command-line system utility that is supposed to 
prevent the computer from sleeping. I haven't tried it yet. Has anyone here 
used it? If so, can you describe how?

I first deployed this system in 1995 under 3.x and it has provided continuous 
near 24/7/365 service since then. It has a small, but global user base which is 
primarily web-based. The machine in question is the web 'client', but it also 
runs a Apache for static web content and an SFTP server. This system has 
remained largely unchanged functionality-wise in the last 10 years. The main 
structure changes have been those required to upgrade major 4D versions. I 
maintain this system, but haven't implemented many newer 4D features. I've 
tried to stay aware of how 4D has changed.

While I can appreciate Apple's intentions with the power management features, 
my experience has been that they increasingly work against running 4D 24/7. 
This system is deployed on a network at a govt. agency. Their cyber security 
people force us to run the latest OS. No recent OS upgrade seems to go smoothly 
4D-wise. The 4D client in question had always run for weeks or even months w/o 
problems, but every Mac OS upgrade seems to lessen that. Moving this web system 
to Windows is not an option. We do run 4D Server on Windows.

I have a number of controls in place to to ensure that the system is running. 

1. Auto-launch 4D Remote in web serving mode if it is not running.  I can 
toggle this on/off. This is done with a combination of shell scripts and 
AppleScript. Apple's Launchd system manages this.
2. Continuously monitor the 4D web server. Every few minutes an off-site 
monitoring agent requests a simple dynamically generated page. If the request 
times out, or if the response contains unexpected content, I get notified. 
These requests provide an added benefit of keeping 4D busy during light or no 
usage periods.
3. There is not an easy way to externally determine if 4D, or any Mac OS 
desktop app has hung. You can easily detect if 4D is running, but not when it 
is non-responsive. For us this is when 4D has encountered a low-level error 
that can't be gracefully handled with an error handler. It doesn't help that 
any displayed dialogs provide little useful information. One solution is to 
have 4D run a process that writes a 'heartbeat' file every minute and have a 
system process check for changes to this file. If the file is present and 
hasn't changed in more than a few minutes, we'll assume that 4D has hung and 
run a script to kill it. At this point the auto-launcher from (1) above takes 
over. This is where we seem to be failing currently. 

If others have done (3) how do you implement your heartbeat? I write a current 
timestamp into the file every minute. That assumes the file exists and is 
writable. It usually is. Is there a better way that is more robust?

I know that 4D has improved logging features, but I've never used them. What 
would I need to do to enable 4D to log between 2:45 and 3:15 AM? 

Thanks,

Brad

________________________________________
From: Perkins, Bradley D
Sent: Monday, October 30, 2017 9:08 AM
To: [email protected]
Subject: Re: 4D Remote hanging at 3am after upgrading to Hi Sierra.

I think I found the problem. When I upgraded the server OS on Tuesday I had a 
second GUI login session open for the admin user as I needed to sudo to fix 
some permissions, etc (aka fast user switching). When I checked on the 
application early Saturday AM I realized I had left that user logged in with an 
idle terminal session. I also found that when I remotely logged in to to check 
on the 'web client' user that 4D was not running, but quickly launched (my 
login woke the system up). I suspect that power management features were 
causing the network and/or hard disks to 'sleep' at 3AM. We have not had 
problems since logging that user out. Therefore, even though you may think that 
Power Nap is configured to be off, it isn't totally.

Brad Perkins.

On 10/27/17, 3:02 PM, "Perkins, Bradley D" <[email protected]> wrote:

    I have grep'd everything in /var/log --- the files the the console displays 
-- and haven't found anything that is running at 3am. That is assuming of 
course that any system level activity would be logged. The closest entry is at 
3:01 and that is when my monitoring script emails me the first of many messages 
that there is a problem.

    I was mainly asking here in case those that are more in tune with current 
Mac goings on were aware of anything new in High Sierra that might have caused 
problems with 4D.

    I'm not familiar with the use of  4D's debug/request log. Can that be 
turned on easily, or do I have to recompile the structure to enable it?
    I'm mainly interested in what is going on at the client. I'd also guess 
that whatever is hanging 4D might not get logged to the server.

    Thanks,

    Brad

    > From: JBellos <[email protected]>

    > Try turning on the debug/request log in 4D to see what's firing in your
    > application at that time, if anything..

    > Also, look at the Mac Console log to see what's happening at 3 AM, if
    > there's anything unique running there that's not  happening earlier.

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to