Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
1f387af2
Commit
1f387af2
authored
Sep 03, 2016
by
Jeromy Johnson
Committed by
GitHub
Sep 03, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3149 from ipfs/test/fdlimit-raising
fdlimit: improve fdlimit autoraising tests
parents
309535c0
af914c51
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
4 deletions
+33
-4
cmd/ipfs/ulimit_unix.go
cmd/ipfs/ulimit_unix.go
+8
-1
package.json
package.json
+6
-0
test/Makefile
test/Makefile
+8
-0
test/sharness/Makefile
test/sharness/Makefile
+1
-1
test/sharness/t0060-daemon.sh
test/sharness/t0060-daemon.sh
+10
-2
No files found.
cmd/ipfs/ulimit_unix.go
View file @
1f387af2
...
...
@@ -30,12 +30,15 @@ func checkAndSetUlimit() error {
return
fmt
.
Errorf
(
"error getting rlimit: %s"
,
err
)
}
var
setting
bool
if
rLimit
.
Cur
<
ipfsFileDescNum
{
if
rLimit
.
Max
<
ipfsFileDescNum
{
log
.
Error
(
"adjusting max"
)
rLimit
.
Max
=
ipfsFileDescNum
}
fmt
.
Printf
(
"Adjusting current ulimit to %d.
\n
"
,
ipfsFileDescNum
)
fmt
.
Printf
(
"Adjusting current ulimit to %d.
..
\n
"
,
ipfsFileDescNum
)
rLimit
.
Cur
=
ipfsFileDescNum
setting
=
true
}
err
=
syscall
.
Setrlimit
(
syscall
.
RLIMIT_NOFILE
,
&
rLimit
)
...
...
@@ -43,5 +46,9 @@ func checkAndSetUlimit() error {
return
fmt
.
Errorf
(
"error setting ulimit: %s"
,
err
)
}
if
setting
{
fmt
.
Printf
(
"Successfully raised file descriptor limit to %d.
\n
"
,
ipfsFileDescNum
)
}
return
nil
}
package.json
View file @
1f387af2
...
...
@@ -189,6 +189,12 @@
"hash"
:
"QmVvJ27GcLaLSXvcB4auk3Gn3xuWK5ti5ENkZ2pCoJEYW4"
,
"name"
:
"autobatch"
,
"version"
:
"0.2.0"
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"QmdCL8M8DXJdSRnwhpDhukX5r8ydjxnzPJpaKrFudDA8yn"
,
"name"
:
"hang-fds"
,
"version"
:
"0.0.0"
}
],
"gxVersion"
:
"0.4.0"
,
...
...
test/Makefile
View file @
1f387af2
...
...
@@ -60,10 +60,18 @@ multihash_src:
$(
eval
MULTIHASH_HASH :
=
$(
shell
cd
..
&&
bin/gx deps find go-multihash
))
$(
eval
MULTIHASH_SRC :
=
gx/ipfs/
$(MULTIHASH_HASH)
/go-multihash
)
hang-fds_src
:
$(
eval
HANG_FDS_HASH :
=
$(
shell
cd
..
&&
bin/gx deps find hang-fds
))
$(
eval
HANG_FDS_SRC :
=
gx/ipfs/
$(HANG_FDS_HASH)
/hang-fds
)
bin/multihash
:
multihash_src $(call find_go_files
,
$(MULTIHASH_SRC)) IPFS-BUILD-OPTIONS
@
echo
"*** installing
$@
***"
go build
$(GOFLAGS)
-o
bin/multihash
$(MULTIHASH_SRC)
/multihash
bin/hang-fds
:
hang-fds_src $(call find_go_files
,
$(HANG_FDS_SRC)) IPFS-BUILD-OPTIONS
@
echo
"*** installing
$@
***"
go build
$(GOFLAGS)
-o
bin/hang-fds
$(HANG_FDS_SRC)
iptb_src
:
$(
eval
IPTB_HASH :
=
$(
shell
cd
..
&&
bin/gx deps find iptb
))
$(
eval
IPTB_SRC :
=
gx/ipfs/
$(IPTB_HASH)
/iptb
)
...
...
test/sharness/Makefile
View file @
1f387af2
...
...
@@ -8,7 +8,7 @@
T
=
$(
sort
$(
wildcard
t[0-9][0-9][0-9][0-9]-
*
.sh
))
BINS
=
bin/random bin/multihash bin/ipfs bin/pollEndpoint
\
bin/iptb bin/go-sleep bin/random-files bin/go-timeout
bin/iptb bin/go-sleep bin/random-files bin/go-timeout
bin/hang-fds
SHARNESS
=
lib/sharness/sharness.sh
IPFS_ROOT
=
../..
...
...
test/sharness/t0060-daemon.sh
View file @
1f387af2
...
...
@@ -121,12 +121,20 @@ test_expect_success "daemon with pipe eventually becomes live" '
test_fsh cat stdin_daemon_out || test_fsh cat stdin_daemon_err || test_fsh cat stdin_poll_apiout || test_fsh cat stdin_poll_apierr
'
ulimit
-n
512
ulimit
-S
-n
512
TEST_ULIMIT_PRESET
=
1
test_launch_ipfs_daemon
test_expect_success
"daemon raised its fd limit"
'
grep "ulimit" actual_daemon > /dev/null
grep "raised file descriptor limit to 1024." actual_daemon > /dev/null
'
test_expect_success
"daemon actually can handle 1024 file descriptors"
'
hang-fds -hold=2s 1000 '
$API_MADDR
'
'
test_expect_success
"daemon didnt throw any errors"
'
test_expect_code 1 grep "too many open files" daemon_err
'
test_kill_ipfs_daemon
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment