htfy96 / c10k-server

[Abandoned] A toy asynchronous server, written in C++14
Apache License 2.0
18 stars 4 forks source link

Fix connection #1

Open htfy96 opened 7 years ago

htfy96 commented 7 years ago
  1. [x] Connection won't be closed on error(High)
  2. [x] Provide an mechanism to allow user to close connection(Medium)
  3. [x] Use dup to monitor POLLIN and POLLOUT individually on two different epoll events Monitor event on single fd, since we need to handle close (High)
  4. [ ] Signal handling(Medium)
  5. [x] Memory pool?(Low) [No time for this 😭 ]
  6. [x] Exception handling(Low)
  7. [x] Fix incorrect ownership
htfy96 commented 7 years ago

https://travis-ci.org/htfy96/c10k-server/jobs/195526832 Build was broken.

Didn't appear in the latest build. Possible causes:

Fixed by https://github.com/htfy96/c10k-server/commit/09753751a5d439bd82898ed9837e49bc12f7e698.

According to man 3 socket:

The socket() function may fail if: ENOBUFS Insufficient resources were available in the system to perform the operation.

In our test_common.hpp(https://github.com/htfy96/c10k-server/commit/09753751a5d439bd82898ed9837e49bc12f7e698#diff-98636da8eed2704a07464a7657f2b580L41), we created an unused socket. Since TEST_CNT=600 before the above commit, and each test consists of 1 client socket, 1 server socket and 1 unused socket, 600 * 3 > 1024 = max_fn, while socket still returns a invalid socket fd in this case, which propagates into other functions(even triggered exception in Connection::close)

Solution: Remove unused socket and reduce TEST_CNT=500