Skip to content
This repository has been archived by the owner on Jul 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #109 from shsmith/fix-103
Browse files Browse the repository at this point in the history
fix issue #103 check open files limit during initialization
  • Loading branch information
ThomasV committed Jul 19, 2015
2 parents b6daa51 + b591c0f commit 88a6531
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions run_electrum_server
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import threading
import json
import os
import imp
import resource


if os.path.dirname(os.path.realpath(__file__)) == os.getcwd():
Expand All @@ -49,6 +50,12 @@ if os.getuid() == 0:
print "Run the install script to create a non-privileged user."
sys.exit()

# prevent database corruption due to default open file limits
softlimit, hardlimit = resource.getrlimit(resource.RLIMIT_OFILE)
if hardlimit < 64000:
print "Warning: Your open files limit is too low."
sys.exit()

def attempt_read_config(config, filename):
try:
with open(filename, 'r') as f:
Expand Down

0 comments on commit 88a6531

Please sign in to comment.