How to Fix: Uninstall, Reinstall ScreenConnect Server (Mono Out of Memory Error)

Dennis Faas's picture

Infopackets Reader Steve V. writes:

" Dear Dennis,

I came across your post on screenconnect.com, entitled 'Mono eating too much memory (Linux)' and am having the same issue. It seems that ScreenConnect is uncontrollably eating memory - for example, when I click on client previews, the mono process eats 300mb+ of RAM and will continue to do so for each click. Surely this is not right! At this point I receive 'Internal error' on my ScreenConnect browser control panel (where I can view my clients). Ultimately, /var/log/messages reports 'Out of memory: Kill process xxxx (mono) score xxx or sacrifice child', at which point it appears that the operating system kills the process and memory is freed, only to have the same thing repeat throughout the day. This is very vexing! I have searched ScreenConnect forums for help, to no avail. I was wondering if you came across a solution? "

My response:

Unfortunately I did not receive any replies from ScreenConnect staff (which is very disappointing), nor any support from the forum. I tried reinstalling the program over top of itself, but that did nothing; I also tried to downgrade to the previous ScreenConnect release, only to find that this was not allowed by the installer (install.sh). I then made an image snapshot of my Linux virtual machine running ScreenConnect, and attempted to reinstall ScreenConnect server on my own, and was eventually successful. Below I'll explain how to do that.

How to Fix: Uninstall, Reinstall ScreenConnect Server (Mono Out of Memory Error)

The instructions below are for the Linux terminal (Centos / Redhat compatible) and will demonstrate how to reinstall the ScreenConnect Server service. All my comments begin with four hash marks. If you're running a virtual machine I suggest you take an image snapshot in case you need to roll back.

####First, stop the ScreenConnect service.

service screenconnect stop

####Move the ScreenConnect folder to ScreenConnect.old. Take note of the capitalization of the folder, if any. Newer releases use '/opt/screenconnect/' as the default install directory, and not '/opt/ScreenConnect'. When you reinstall, use the same folder name so that any services on the system (log rotate, for example) won't be interrupted.

mv /opt/ScreenConnect /opt/ScreenConnect.old

####Download the latest ScreenConnect, untar it, then run install.sh to install it

cd /dloads
wget https://d1kuyuqowve5id.cloudfront.net/ScreenConnect_6.1.12292.6236_Relea...
tar -xvzf ScreenConnect_6.1.12292.6236_Release.tar.gz
cd ScreenConnect_6.1.12292.6236_Install
sh install.sh

####output

Welcome to the ScreenConnect Installer

...

####Note the install folder - change accordingly

Where would you like to install ScreenConnect?
[/opt/screenconnect] /opt/ScreenConnect

...

Installation complete!

####Shut down service, update file system database, locate web.confg, make a backup of web.config, edit it and insert proper IP for your server

service screenconnect stop
updatedb
slocate web.config
cp /opt/ScreenConnect/web.config /opt/ScreenConnect/web.config.orig
nano -w /opt/ScreenConnect/web.config

####Edit the original web.config and compare it to your old modified version. Insert the following modified entries:

<add key="WebServerListenUri" value="http:// example.com:80/"></add>
<add key="RelayListenUri" value="relay:// example.com:443/"></add>
<add key="WebServerAddressableUri" value="http:// example.com/"></add>
<add key="DefaultScreenQualityLevel" value="Medium"></add>

####You also will need to reset the admin password (required for new install / reinstall):

<add key="IsSetup" value="false"></add>

####Now, save or re-upload web.config using ftp, then restart the ScreenConnect service

service screenconnect start

Once the service is restarted, you can access your ScreenConnect portal and set your login, password, and re-enter your ScreenConnect license.

NOTE: At this point, ScreenConnect should finish up the installation and redirect you to your portal. I went through this process twice and each time received and "internal error". I ignored the error, entered in my http:// portal and everything worked fine. After ScreenConnect is installed you can view its memory usage using the 'top -c' command, then press Shift + F, N, then Enter to sort by memory. Mono should be eating around 175 mb - 200 mb of RAM.

Copying over your old Sessions

I have not tried this, but if you want to port over your old ScreenConnect sessions, I believe the way to achieve this is to make a backup of your current Session.db* files in /opt/ScreenConnect/App_Data, then copy over your old session files:

####stop ScreenConnect service first

service screenconnect stop

####backup the originals first in case this doesn't work

cp /opt/ScreenConnect/App_Data/Session.db /opt/ScreenConnect/App_Data/Session.db.orig
cp /opt/ScreenConnect/App_Data/Session.db-shm /opt/ScreenConnect/App_Data/Session.db-shm.orig
cp /opt/ScreenConnect/App_Data/Session.db-wal /opt/ScreenConnect/App_Data/Session.db-wal.orig

####copy over the old Session.db* files:

cp /opt/ScreenConnect.old/App_Data/Session.db /opt/ScreenConnect/App_Data/Session.db
cp /opt/ScreenConnect.old/App_Data/Session.db-shm /opt/ScreenConnect/App_Data/Session.db-shm
cp /opt/ScreenConnect.old/App_Data/Session.db-wal /opt/ScreenConnect/App_Data/Session.db-wal

####restart ScreenConnect service

service screenconnect start

I hope that helps.

Additional 1-on-1 Support: From Dennis

If all of this is over your head and you need help reinstalling ScreenConnect on your server, I can help. Simply contact me briefly describing the issue and I will get back to you as soon as possible.

Got a Computer Question or Problem? Ask Dennis!

I need more computer questions. If you have a computer question - or even a computer problem that needs  fixing - please email me with your question so that I can write more articles like this one. I can't promise I'll respond to all the messages I receive (depending on the volume), but I'll do my best.

About the author: Dennis Faas is the owner and operator of Infopackets.com. With over 30 years of computing experience, Dennis' areas of expertise are a broad range and include PC hardware, Microsoft Windows, Linux, network administration, and virtualization. Dennis holds a Bachelors degree in Computer Science (1999) and has authored 6 books on the topics of MS Windows and PC Security. If you like the advice you received on this page, please up-vote / Like this page and share it with friends. For technical support inquiries, Dennis can be reached via Live chat online this site using the Zopim Chat service (currently located at the bottom left of the screen); optionally, you can contact Dennis through the website contact form.

Rate this article: 
Average: 4.5 (4 votes)