Skip to content

Commit 03278d2

Browse files
committed
Add readme
1 parent 49161a6 commit 03278d2

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,83 @@ Original issues:
77
* https://github.com/http-party/node-http-proxy/issues/1586
88
* https://github.com/chimurai/http-proxy-middleware/issues/782
99

10+
## Running locally
1011

12+
Install dependencies:
13+
14+
```sh
15+
npm ci
16+
```
17+
18+
Run the server:
19+
20+
```sh
21+
npm start
22+
```
23+
24+
Start meking requests from TTY:
25+
26+
27+
```sh
28+
while :; do curl -s -I -X GET http://localhost:7000/sample.png > /dev/null; done
29+
```
30+
31+
## Running in dockerized environment
32+
33+
Run docker-compose:
34+
35+
```sh
36+
sudo docker-compose up --build
37+
```
38+
39+
## Memory leak
40+
41+
Running the above code results in a memoy leak and crush the server after a minute or so:
42+
43+
```
44+
45+
> http-server public -p ${HTTP_SERVER_PORT:-5000} -s &
46+
47+
48+
49+
> node --max-old-space-size=128 src/index.js
50+
51+
server is listenning on port 7000
52+
(node:535729) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
53+
(Use `node --trace-deprecation ...` to show where the warning was created)
54+
Memory usage: 38.62MB (4.11MB heap, 24.18KB buffers)
55+
Memory usage: 107.71MB (12.43MB heap, 49.72MB buffers)
56+
Memory usage: 312.09MB (30.56MB heap, 198.18MB buffers)
57+
Memory usage: 449.22MB (47.46MB heap, 291.36MB buffers)
58+
Memory usage: 584.92MB (68.47MB heap, 374.63MB buffers)
59+
Memory usage: 714.77MB (90.07MB heap, 459.3MB buffers)
60+
61+
<--- Last few GCs --->
62+
in[535736:0x63ab030] 109731 ms: Mark-sweep 103.6 (138.1) -> 102.8 (138.4) MB, 2.4 / 0.1 ms (+ 108.6 ms in 1552 steps since start of marking, biggest step 1.0 ms, walltime since start of marking 127 ms) (average mu = 0.186, current mu = 0.190) finalize in[535736:0x63ab030] 109864 ms: Mark-sweep 103.8 (138.4) -> 103.0 (138.6) MB, 2.3 / 0.1 ms (+ 107.8 ms in 1516 steps since start of marking, biggest step 2.3 ms, walltime since start of marking 125 ms) (average mu = 0.181, current mu = 0.175) finalize in
63+
64+
<--- JS stacktrace --->
65+
66+
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
67+
1: 0xb00d90 node::Abort() [node]
68+
2: 0xa1823b node::FatalError(char const*, char const*) [node]
69+
3: 0xcedbce v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
70+
4: 0xcedf47 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
71+
5: 0xea6105 [node]
72+
6: 0xea6be6 [node]
73+
7: 0xeb4b1e [node]
74+
8: 0xeb5560 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
75+
9: 0xeb6697 v8::internal::Heap::FinalizeIncrementalMarkingIfComplete(v8::internal::GarbageCollectionReason) [node]
76+
10: 0xeba1b0 v8::internal::IncrementalMarkingJob::Task::RunInternal() [node]
77+
11: 0xdabeeb non-virtual thunk to v8::internal::CancelableTask::Run() [node]
78+
12: 0xb6e964 node::PerIsolatePlatformData::RunForegroundTask(std::unique_ptr<v8::Task, std::default_delete<v8::Task> >) [node]
79+
13: 0xb707c9 node::PerIsolatePlatformData::FlushForegroundTasksInternal() [node]
80+
14: 0x155a336 [node]
81+
15: 0x156c7a4 [node]
82+
16: 0x155ac68 uv_run [node]
83+
17: 0xa3dfe5 node::SpinEventLoop(node::Environment*) [node]
84+
18: 0xb42dc6 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [node]
85+
19: 0xac4812 node::Start(int, char**) [node]
86+
20: 0x7f6700aef083 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
87+
21: 0xa3bf3c [node]
88+
Aborted (core dumped)
89+
```

0 commit comments

Comments
 (0)