mattn / mattn/mruby-thread

Multithreaded TCPServer crashes immediately

Open
#64 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
49
Forks
31
PR merge metrics
No merged PRs in 30d

Description

Was: https://github.com/mruby/mruby/issues/4949

This:

server = TCPServer.open(8000)    
loop do                          
	Thread.start(server.accept) do |client|
		client.write "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: close\r\nContent-Length: 11\r\n\r\nHello world"
		client.close                  
	end
end

on Ubuntu 18.04.
At the first request, the program exits with a Segmentation fault.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the first-request crash with the TCPServer.open, server.accept, and Thread.start example on Ubuntu 18.04. Then inspect the mruby-thread implementation behind these entry points. Done means the example serves its response without a segmentation fault.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, ruby, ubuntu
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.