← Back to team overview

desktop-packages team mailing list archive

[Bug 1441914] [NEW] lua:socket settimeout does not work

 

Public bug reported:

Ubuntu Version:  Ubuntu 14.04.2 LTS
package lua-socket:i386 3.0~rc1-3

On Ubuntu 14.04, lua socket settimeout does not work as expected.  On a tcp socket, it causes the next receive to close the connection immediately.
It works correctly on Ubuntu 12.04 and debian 7.

To reproduce:
install packages lua5.1 and lua-socket
Take the echo server example from the introduction to luasocket:
http://w3.impa.br/~diego/software/luasocket/introduction.html
Put it in a file echo.lua and run it with "lua echo.lua"
>From another window, use telnet localhost {port} to connect to the echo server
Result:  Immediately after connecting, the server closes the connection.
Expected Result:  The server should wait 10 seconds for input, then close the connection.


package version that works correctly in debian 7:  lua-socket:i386 2.0.2-8


-------------
A copy of the example (echo.lua):

-- load namespace
local socket = require("socket")
-- create a TCP socket and bind it to the local host, at any port
local server = assert(socket.bind("*", 0))
-- find out which port the OS chose for us
local ip, port = server:getsockname()
-- print a message informing what's up
print("Please telnet to localhost on port " .. port)
print("After connecting, you have 10s to enter a line to be echoed")
-- loop forever waiting for clients
while 1 do
  -- wait for a connection from any client
  local client = server:accept()
  -- make sure we don't block waiting for this client's line
  client:settimeout(10)
  -- receive the line
  local line, err = client:receive()
  -- if there was no error, send it back to the client
  if not err then client:send(line .. "\n") end
  -- done with client, close the object
  client:close()
end

** Affects: unity (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to unity in Ubuntu.
Matching subscriptions: dp-unity
https://bugs.launchpad.net/bugs/1441914

Title:
  lua:socket settimeout does not work

Status in unity package in Ubuntu:
  New

Bug description:
  Ubuntu Version:  Ubuntu 14.04.2 LTS
  package lua-socket:i386 3.0~rc1-3

  On Ubuntu 14.04, lua socket settimeout does not work as expected.  On a tcp socket, it causes the next receive to close the connection immediately.
  It works correctly on Ubuntu 12.04 and debian 7.

  To reproduce:
  install packages lua5.1 and lua-socket
  Take the echo server example from the introduction to luasocket:
  http://w3.impa.br/~diego/software/luasocket/introduction.html
  Put it in a file echo.lua and run it with "lua echo.lua"
  From another window, use telnet localhost {port} to connect to the echo server
  Result:  Immediately after connecting, the server closes the connection.
  Expected Result:  The server should wait 10 seconds for input, then close the connection.

  
  package version that works correctly in debian 7:  lua-socket:i386 2.0.2-8

  
  -------------
  A copy of the example (echo.lua):

  -- load namespace
  local socket = require("socket")
  -- create a TCP socket and bind it to the local host, at any port
  local server = assert(socket.bind("*", 0))
  -- find out which port the OS chose for us
  local ip, port = server:getsockname()
  -- print a message informing what's up
  print("Please telnet to localhost on port " .. port)
  print("After connecting, you have 10s to enter a line to be echoed")
  -- loop forever waiting for clients
  while 1 do
    -- wait for a connection from any client
    local client = server:accept()
    -- make sure we don't block waiting for this client's line
    client:settimeout(10)
    -- receive the line
    local line, err = client:receive()
    -- if there was no error, send it back to the client
    if not err then client:send(line .. "\n") end
    -- done with client, close the object
    client:close()
  end

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1441914/+subscriptions


Follow ups

References