Blank AltUI homepage

Got my Raspberry Pi 2 and started to getting openLuup on board right away ;D
Well, needed to upgrade to Rasbian Jessie and compile my own luasec first.

After putting all files inplace, here is what I did:

  1. lua openLuup/init.lua reset
  2. lua openLuup/init.lua
  3. call http://…:3480/data_request?id=alive and got OK
  4. call http://…:3480/data_request?id=user_data and got json data back
  5. call http://…:3480/data_request?id=altui to install AltUI
  6. After reload, call http://…:3480/data_request?id=lr_ALTUI_Handler&command=home

The page loads for a while and stayed blank. Log contains the following:

2015-11-13 06:00:06.208   openLuup.server:: /data_request?id=lr_ALTUI_Handler&command=home tcp{client}: 0x1ac2e40
2015-11-13 06:00:06.209   luup_log:3: ALTUI: ALTUI_Handler: request is: lr_ALTUI_Handler
2015-11-13 06:00:06.209   luup_log:3: ALTUI: ALTUI_Handler: parameters is: {"command":"home"}
2015-11-13 06:00:06.209   luup_log:3: ALTUI: ALTUI_Handler: outputformat is: null
2015-11-13 06:00:06.224   luup_log:3: ALTUI: getScriptContent(J_ALTUI_plugins.js)
2015-11-13 06:00:06.225   luup_log:3: ALTUI: getScriptContent(J_ALTUI_iphone.js)
2015-11-13 06:00:06.226   luup_log:3: ALTUI: getScriptContent(J_ALTUI_jquery.ui.touch-punch.min.js)
2015-11-13 06:00:06.228   luup_log:3: ALTUI: getScriptContent(J_ALTUI_b_blockly_compressed.js)
2015-11-13 06:00:06.253   luup_log:3: ALTUI: getScriptContent(J_ALTUI_b_blocks_compressed.js)
2015-11-13 06:00:06.263   luup_log:3: ALTUI: getScriptContent(J_ALTUI_b_en.js)
2015-11-13 06:00:06.267   luup_log:3: ALTUI: getScriptContent(J_ALTUI_b_javascript_compressed.js)
2015-11-13 06:00:06.272   luup_log:3: ALTUI: getScriptContent(J_ALTUI_b_lua_compressed.js)
2015-11-13 06:00:06.318   openLuup.server:: error 'timeout' sending 861954 bytes to tcp{client}: 0x1ac2e40
2015-11-13 06:00:06.319   openLuup.server:: ...only 27726 bytes sent
2015-11-13 06:00:06.319   openLuup.server:: error 'timeout' sending 2 bytes to tcp{client}: 0x1ac2e40
2015-11-13 06:00:06.319   openLuup.server:: ...only 0 bytes sent
2015-11-13 06:00:06.319   openLuup.server:: error 'timeout' sending 5 bytes to tcp{client}: 0x1ac2e40
2015-11-13 06:00:06.320   openLuup.server:: ...only 0 bytes sent
2015-11-13 06:00:06.320   openLuup.server:: request completed (861954 bytes, 2 chunks, 111 ms) tcp{client}: 0x1ac2e40
2015-11-13 06:00:06.527   openLuup.server:: new client connection: tcp{client}: 0x1b18818
2015-11-13 06:00:06.531   openLuup.server:: /J_ALTUI_utils.js tcp{client}: 0x1b18818
2015-11-13 06:00:06.535   openLuup.server:: error 'timeout' sending 35046 bytes to tcp{client}: 0x1b18818
2015-11-13 06:00:06.536   openLuup.server:: ...only 27726 bytes sent
2015-11-13 06:00:06.536   openLuup.server:: error 'timeout' sending 2 bytes to tcp{client}: 0x1b18818
2015-11-13 06:00:06.536   openLuup.server:: ...only 0 bytes sent
2015-11-13 06:00:06.536   openLuup.server:: error 'timeout' sending 5 bytes to tcp{client}: 0x1b18818
2015-11-13 06:00:06.536   openLuup.server:: ...only 0 bytes sent
2015-11-13 06:00:06.536   openLuup.server:: request completed (35046 bytes, 2 chunks, 5 ms) tcp{client}: 0x1b18818

I am running as root so that should rule out access issues.

Anyone hit this issue before?

And I cloned from GIT on Nov 10th.

Thanks for trying openLuup, and sorry you’ve hit an early problem.

The HTTP request timeouts happen after 27726 bytes, which is a curious number, since the port 3480 server sends in chunks of 16000. It’s also strange that you are getting a timeout only 100mS after the request is initiated.

[ul][li]You’re confident you have the right luasocket library installed?[/li]
[li]What browser are you using?[/li][/ul]

I am using Chrome. And yes, lua-socket package is installed.

root@orbitarpi:/home/pi# aptitude show lua-socket
Package: lua-socket
State: installed
Automatically installed: no
Multi-Arch: same
Version: 3.0~rc1-3
Priority: optional
Section: interpreters
Maintainer: Enrico Tassi <gareuselesinge@debian.org>
Architecture: armhf
Uncompressed Size: 276 k
Depends: libc6 (>= 2.15)
PreDepends: multiarch-support
Provides: lua5.1-socket, lua5.2-socket
Description: TCP/UDP socket library for the Lua language
 Luasocket provides a TCP/UDP socket library for the Lua language

 Also provided are HTTP and SMTP implementations, a simple FTP implementation
 and some URL parsing functions.

 Luasocket supports blocking and non-blocking sockets and also provides a
 select() interface to the language.
Homepage: http://w3.impa.br/~diego/software/luasocket/

[quote=“dreamcryer, post:1, topic:189653”]Got my Raspberry Pi 2 and started to getting openLuup on board right away ;D
Well, needed to upgrade to Rasbian Jessie and compile my own luasec first.[/quote]

So a version of Debian, then.

You HAVE installed Lua5.1 and not anything greater?

Yeah, I didn’t install 5.2. I went back and checked, there was a liblua5.2-0 package installed automatically by the distribution for mplayer and other two programs. I removed liblua5.2-0 but still did not help the situation.

BTW, I also found liblua5.1-sec (luasec) in APT so I removed my own compiled version and used that one. Didn’t help the situation, either.

Have you got luasec installed? It turns out that the latest versions of AltUI require that too.

apt-get install lua-sec

Can I see a complete log from startup?

Hey akbooer,
I did some debugging. It looks like the client socket timeout value was very short. I put a line in send_chunk() in server.lua

sock: settimeout(nil)

AltUI homepage now loads correctly.

I haven’t have time to read through all your code to see where is the best place to set the timeout. Maybe in the place where the new client socket is created. I am also attaching the log file you requested as a reference. You can see that almost every file openLuup tries to send to the browser were able to send out exactly same number of characters. That’s why I suspected the default timeout value.

Well this sounds great. I’m not in front of my development system right now, so can’t yet confirm, but if so that’s absolutely great. I can abandoned the chunked encoding which may also solve other problems. I’ll take a look when I can.

Thanks and kudos.

I have been through this with a fine toothed comb before, and glancing now at GitHub I see that the socket is created on line 370 of openLUup/server.lua

      local sock = server:accept()
      if sock then new_client (sock) end

and the timeout is set to 10 seconds on line 352 in new_client()

log ("new client connection: " .. tostring(sock))
  expiry = socket.gettime () + CLOSE_SOCKET_AFTER        -- set initial socket expiry 
  sock:settimeout(10)                                    -- this is a timeout on the HTTP read
--  sock:setoption ("linger", {on = true, timeout = 1})  -- TODO: trying to fix timeout error on long strings

So I’m a bit at a loss to work out why you found it to have a short timeout, unless we are not talking about that same socket. The timeout parameter is in seconds, and not milliseconds, I believe.

Confused.

OK. I am baffled, too.

I tested a little more, and we are talking about the same sock object. However, if you have sock::settimeout() called to set any value except nil (tried 100, 10000, 100000), it will time out on the second chunk. Removing the call or pass in nil works.

Maybe we should just remove chunk send as you suggested :slight_smile:

Testing that (Again) as we speak, but running into difficulties. Maybe it’s too late to be trying tonight!

take your time!