Giter VIP home page Giter VIP logo

raven-lua's Introduction

raven-lua

Build Status

A small Lua interface to Sentry that also has a helpful wrapper function call() that takes any arbitrary Lua function (with arguments) and executes it, traps any errors and reports it automatically to Sentry.

Synopsis

    local raven = require "raven"

    -- http://pub:[email protected]:8080/sentry/proj-id
    local rvn = raven.new {
        -- multiple senders are available for different networking backends,
        -- doing a custom one is also very easy.
        sender = require("raven.senders.luasocket").new {
            dsn = "http://pub:[email protected]:8080/sentry/proj-id",
        },
        tags = { foo = "bar" },
    }

    -- Send a message to sentry
    local id, err = rvn:captureMessage(
      "Sentry is a realtime event logging and aggregation platform.",
      { tags = { abc = "def" } } -- optional
    )
    if not id then
       print(err)
    end

    -- Send an exception to sentry
    local exception = {{
       ["type"]= "SyntaxError",
       ["value"]= "Wattttt!",
       ["module"]= "__builtins__"
    }}
    local id, err = rvn:captureException(
       exception,
       { tags = { abc = "def" } } -- optional
    )
    if not id then
       print(err)
    end

    -- Catch an exception and send it to sentry
    function bad_func(n)
       return not_defined_func(n)
    end

    -- variable 'ok' should be false, and an exception will be sent to sentry
    local ok = rvn:call(bad_func, 1)

Documentation

See docs/index.html for more details.

Prerequisites

To run the tests:

    luarocks install lunit
    luarocks install lua-cjson
    luarocks install luaposix
    luarocks install luasocket
    luarocks install luasec

    make test

To generate the docs:

    luarocks install ldoc

    make doc

raven-lua's People

Contributors

agentzh avatar calio avatar dndx avatar elvinefendi avatar jdesgats avatar jgrahamc avatar lewisjellis avatar mattrobenolt avatar nevmerzhitsky avatar ye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raven-lua's Issues

http_send() blocks at connect when using ngx.socket

When I test DSN with lua command line, I can successfully send message to Sentry server. But when running in open-resty, I cannot send any message to Sentry. Adding logs to raven.lua, I found the code always blocks when calling sock:connect:

ngx.log(ngx.ERR, "after tcp, before connect", self.host, self.port)
   ok, err = sock:connect(self.host, self.port)
   if not ok then
      return nil, err
   end
ngx.log(ngx.ERR,` "after connect, before send")

The second log never gots printed.

What could be wrong?

Events Arrive At Sentry Only Once (Wat)

I realize this is vague, so apologies in advance. :(

I am able to get raven to send an event to Sentry, but then subsequent events no longer arrive.
What happens is, I set things up, then I run my app, force an error, then 1 exception and 1 message arrive in Sentry -- subsequent runs of my app or trigging the error no longer show up.

What I can verify is that everything seems to be called correctly, and subsequent calls log the right values. I've seen the behavior on both an onprem and the hosted (free) Sentry.

It's very likely I am doing something wrong, but so far my searching hasn't turned up any useful leads. I'd appreciate any pointers or reports if someone has run into a similar issue.

   -- inside my app's handle_error() method
local rvn = raven.new({
    -- multiple senders are available for different networking backends,
    -- doing a custom one is also very easy.
    sender = require("raven.senders.luasocket").new { dsn = dsn_url },
    environment = config._name
    -- release = '1234',
    -- user = { email = '[email protected]', id = 365, username = 'cycomachead' },
})
    local id, err2 = rvn:captureException(
        { {
            type = "Test Type 2",
            module = "test module",
            message = "Test",
            value = err .. '1',
            stacktrace = trace,
        } },
        -- self.original_request.error
        { user = { id = 305, username = 'cycomachead'} } -- optional
    )
    print('ID: ')
    print(id) -- just to verify and ID is correctly printed.
    local mId, mErr = rvn:captureMessage('TESTING') -- this also prints correctly.

Support for HAProxy socket sender?

I see you guys implemented native support for OpenResty NGINX socket types as well as luasocket:

https://github.com/cloudflare/raven-lua/blob/master/raven/senders/

We use Lua in HAProxy which has its own Socket class implementation (compatible with the Lua Socket class) due to the non-blocking nature of HAProxy:

https://www.arpalert.org/src/haproxy-lua-api/2.3/index.html#socket-class

Would you consider a PR that adds a sender for this type of socket as well? Otherwise we cannot use this library as it will block our Lua scripts' operations.

Generated event ids are not random

I ran into a weird issue where Raven would generate the same event ids over and over again. It would also generate the same set ids in a specific order.

I resolved it by using replacing the math.random() function in util.generate_event_id() with resty.random from lua-resty-string which is bundled into Openresty.

Solution I came up with:

local resty_random = require 'resty.random'
local str = require 'resty.string'

function _M.generate_event_id()
    return str.to_hex(resty_random.bytes(16))
end

Is there an explanation to why this was happening?

Support for User, Request Data?

Is there interest in expanding functionality into include user information and request information?

I feel both pieces are personally critical for really debugging a web app with users. Adding them is pretty easy, though I would love to think about what the best interface would be.

master...snap-cloud:snapcloud

Getting request data would be most useful if there were a function for common server configs -- I am happy to provide one for OpenResty (based in part on resty.rollbar).

Add to LuaRocks

Would you consider adding a rockspec to this repository and adding this module to LuaRocks?

Allow sending reports in any phase (ngx only)

Currently, sending a report requires access to the ngx.socket.tcp API, which is not available during all phases (notably during the filter and log phases).

This can be solved by using a timer behind the scenes when required, but causes further complications:

  • ngx.var is not available there (to get the server name)
  • Some tables are globally cached as an optimization, using timer there might create race conditions. We should create new tables for every report: this library is not really supposed to be a hot code path so this should have a negligible impact.

changing cjson dependency to another json library

Hi there!
Original lua-cjson library seems to be abandoned by @mpx (he has no activity for more that year and all PRs are ignored), and the one in @openresty fork has no Lua5.2/5.3 compatibilty too (and also has no PRs for fixing another bugs).

So, how do you think about migrating to another json library?

Cannot run the current tests

Hello!

I try just to execute the current test suite by instruction from the README:

luarocks install lunit
luarocks install lua-cjson
luarocks install luaposix
luarocks install luasocket
luarocks install luasec

make test

But getting this strange error in output:

root@c01a546084c0:/docker# make test
luacheck .
Checking raven/init.lua                           OK
Checking raven/senders/luasocket.lua              OK
Checking raven/senders/ngx.lua                    OK
Checking raven/senders/reference.lua              OK
Checking raven/senders/test.lua                   OK
Checking raven/util.lua                           OK

Total: 0 warnings / 0 errors in 6 files
tsc tests/*.lua
14 tests 14 passed 100 assertions 0 failed 0 errors 0 unassertive 0 pending
sed -e "s|%PWD%|$PWD|" tests/sentry.conf > tests/sentry.conf.out
touch empty-file
resty --http-include $PWD/tests/sentry.conf.out -e 'require("luarocks.loader"); require("telescope.runner")(arg)' empty-file tests/resty/*.lua
ERROR: (command line -e):1: module 'telescope.runner' not found:No LuaRocks module found for telescope.runner
        no field package.preload['telescope.runner']
        no file '/usr/local/openresty/site/lualib/telescope/runner.ljbc'
        no file '/usr/local/openresty/site/lualib/telescope/runner/init.ljbc'
        no file '/usr/local/openresty/lualib/telescope/runner.ljbc'
        no file '/usr/local/openresty/lualib/telescope/runner/init.ljbc'
        no file '/usr/local/openresty/site/lualib/telescope/runner.lua'
        no file '/usr/local/openresty/site/lualib/telescope/runner/init.lua'
        no file '/usr/local/openresty/lualib/telescope/runner.lua'
        no file '/usr/local/openresty/lualib/telescope/runner/init.lua'
        no file './telescope/runner.lua'
        no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/telescope/runner.lua'
        no file '/usr/local/share/lua/5.1/telescope/runner.lua'
        no file '/usr/local/share/lua/5.1/telescope/runner/init.lua'
        no file '/usr/local/openresty/luajit/share/lua/5.1/telescope/runner.lua'
        no file '/usr/local/openresty/luajit/share/lua/5.1/telescope/runner/init.lua'
        no file '/root/.luarocks/share/lua/5.1/telescope/runner.lua'
        no file '/root/.luarocks/share/lua/5.1/telescope/runner/init.lua'
        no file '/usr/local/openresty/site/lualib/telescope/runner.so'
        no file '/usr/local/openresty/lualib/telescope/runner.so'
        no file './telescope/runner.so'
        no file '/usr/local/lib/lua/5.1/telescope/runner.so'
        no file '/usr/local/openresty/luajit/lib/lua/5.1/telescope/runner.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/root/.luarocks/lib/lua/5.1/telescope/runner.so'
        no file '/usr/local/openresty/site/lualib/telescope.so'
        no file '/usr/local/openresty/lualib/telescope.so'
        no file './telescope.so'
        no file '/usr/local/lib/lua/5.1/telescope.so'
        no file '/usr/local/openresty/luajit/lib/lua/5.1/telescope.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/root/.luarocks/lib/lua/5.1/telescope.so'
stack traceback:
        (command line -e):1: in function 'inline_gen'
        init_worker_by_lua:53: in function <init_worker_by_lua:52>
        [C]: in function 'xpcall'
        init_worker_by_lua:61: in function <init_worker_by_lua:59>
make: *** [Makefile:16: test] Error 1

How to reproduce

Clone the master branch of the repository and go inside a root directory.

My environment is Docker image:

FROM openresty/openresty:1.17.8.2-buster

# Install LuaRocks
# based on https://github.com/openresty/docker-openresty/blob/6c7af091115a3da62038a93fb9e4c76ef7080bb7/buster/Dockerfile.luarocks_example
ARG RESTY_LUAROCKS_VERSION="3.3.1"

RUN DEBIAN_FRONTEND=noninteractive apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        curl \
        make \
        unzip \
 && cd /tmp \
 && curl -fSL https://luarocks.github.io/luarocks/releases/luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz -o luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
 && tar xzf luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
 && cd luarocks-${RESTY_LUAROCKS_VERSION} \
 && ./configure \
        --prefix=/usr/local/openresty/luajit \
        --with-lua=/usr/local/openresty/luajit \
        --lua-suffix=jit-2.1.0-beta3 \
        --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 \
 && make build \
 && make install \
 && cd /tmp \
 && rm -rf luarocks-${RESTY_LUAROCKS_VERSION} luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz

WORKDIR /tmp

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        gcc \
        liblua5.1-dev \
        libssl-dev \
        lua-check \
        openresty-opm

RUN luarocks install telescope 0.6.0-1 \
 && luarocks install lunit 0.5-2 \
 && luarocks install lua-cjson 2.1.0.6-1 \
 && luarocks install luaposix 35.0-1 \
 && luarocks install luasocket 3.0rc1-2 \
 && luarocks install luasec 0.9-1

Dump this content to Dockerfile file in the root of the repository. Then run these commands:

docker build -t resty-rocks .
docker run --rm -it -v "$(pwd):/docker/" -w /docker resty-rocks bash

Then just execute make test inside the container.

As you can see, I've did luarocks install telescope 0.6.0-1 to Dockerfile. Without these I got error about tsc command. I think we should add this command to README.md at least because it required to run the tests.

But this library haven't telescope.runner package. Can you advice how to fix the issue?

Failed to send to Sentry: connection reset by peer

The event is POSTed successfully to local Sentry instance but the ravel-lua logs following error:

2019/07/01 12:24:41 [error] 10#10: *10 recv() failed (104: Connection reset by peer), client: 127.0.0.1, server: _, request: "POST /xxx HTTP/1.1", host: "127.0.0.1:7000"
2019/07/01 12:24:41 [error] 10#10: *10 [lua] ngx.lua:32: errlog(): raven-lua failure: Failed to send to Sentry: connection reset by peer {"timestamp":"2019-07-01T12:24:41","message":"xxx",...} , client: 127.0.0.1, server: _, request: "POST /xxx HTTP/1.1", host: "127.0.0.1:7000"

Looks like it's caused by connection to server being closed by Sentry (the module sent Connection: close header in the request) in a way that generates TCP RST packets - SO_LINGER on with zero linger time followed by close().

Example packets captured by tcpdump:

12:37:28.518716 IP 172.20.6.171.34090 > 172.20.2.181.8000: Flags [S], seq 2319457555, win 27560, options [mss 1378,sackOK,TS val 922459539 ecr 0,nop,wscale 7], length 0
12:37:28.518745 IP 172.20.2.181.8000 > 172.20.6.171.34090: Flags [S.], seq 2641603589, ack 2319457556, win 27320, options [mss 1378,sackOK,TS val 119696926 ecr 922459539,nop,wscale 7], length 0
12:37:28.519025 IP 172.20.6.171.34090 > 172.20.2.181.8000: Flags [.], ack 1, win 216, options [nop,nop,TS val 922459540 ecr 119696926], length 0 
12:37:28.519078 IP 172.20.6.171.34090 > 172.20.2.181.8000: Flags [.], seq 1:1367, ack 1, win 216, options [nop,nop,TS val 922459540 ecr 119696926], length 1366
12:37:28.519111 IP 172.20.2.181.8000 > 172.20.6.171.34090: Flags [.], ack 1367, win 235, options [nop,nop,TS val 119696926 ecr 922459540], length 0
12:37:28.519216 IP 172.20.6.171.34090 > 172.20.2.181.8000: Flags [.], seq 1367:2733, ack 1, win 216, options [nop,nop,TS val 922459540 ecr 119696926], length 1366
12:37:28.519227 IP 172.20.2.181.8000 > 172.20.6.171.34090: Flags [.], ack 2733, win 257, options [nop,nop,TS val 119696926 ecr 922459540], length 0
12:37:28.519322 IP 172.20.6.171.34090 > 172.20.2.181.8000: Flags [P.], seq 2733:3812, ack 1, win 216, options [nop,nop,TS val 922459540 ecr 119696926], length 1079
12:37:28.519328 IP 172.20.2.181.8000 > 172.20.6.171.34090: Flags [.], ack 3812, win 278, options [nop,nop,TS val 119696926 ecr 922459540], length 0
12:37:28.543914 IP 172.20.2.181.8000 > 172.20.6.171.34090: Flags [P.], seq 1:367, ack 3812, win 278, options [nop,nop,TS val 119696951 ecr 922459540], length 366
12:37:28.544222 IP 172.20.6.171.34090 > 172.20.2.181.8000: Flags [.], ack 367, win 224, options [nop,nop,TS val 922459565 ecr 119696951], length 0
12:37:28.544677 IP 172.20.2.181.8000 > 172.20.6.171.34090: Flags [R.], seq 367, ack 3812, win 278, options [nop,nop,TS val 119696952 ecr 922459565], length 0 

The sock:receive('*a') function returns error on such connections.

Missing Dependency "LuaSocket" for running unit tests

After a fresh clone of the project repo and installation lunit, luaposix as specified in the README.md, unit tests still won't run.

$ make test
lua: tests/test_exceptions.lua:3: module 'socket' not found:
    no field package.preload['socket']
    no file '/usr/local/share/lua/5.2/socket.lua'
    no file '/usr/local/share/lua/5.2/socket/init.lua'
    no file '/usr/local/lib/lua/5.2/socket.lua'
    no file '/usr/local/lib/lua/5.2/socket/init.lua'
    no file './socket.lua'
    no file '/usr/local/lib/lua/5.2/socket.so'
    no file '/usr/local/lib/lua/5.2/loadall.so'
    no file './socket.so'
stack traceback:
    [C]: in function 'require'
    tests/test_exceptions.lua:3: in function 'chunk'
    /usr/local/share/lua/5.2/lunit.lua:628: in function 'loadtestcase'
    /usr/local/share/lua/5.2/lunit.lua:657: in function 'main'
    stdin:11: in main chunk
    [C]: in ?
make: *** [test] Error 1

It did run after LuaSocket is installed though.

$ luarocks install luasocket
Installing https://luarocks.org/luasocket-3.0rc1-2.src.rock...
Using https://luarocks.org/luasocket-3.0rc1-2.src.rock... switching to 'build' mode
Archive:  v3.0-rc1.zip
22cd5833fcc0e272f26004a79c8545e959ba406b
   creating: luasocket-3.0-rc1/
  inflating: luasocket-3.0-rc1/.gitignore  
  inflating: luasocket-3.0-rc1/.travis.yml  
  inflating: luasocket-3.0-rc1/FIX   
  inflating: luasocket-3.0-rc1/LICENSE  
  inflating: luasocket-3.0-rc1/Lua51.props  
  inflating: luasocket-3.0-rc1/Lua52.props  
  inflating: luasocket-3.0-rc1/NEW   
  inflating: luasocket-3.0-rc1/README  
  inflating: luasocket-3.0-rc1/TODO  
  inflating: luasocket-3.0-rc1/WISH  
   creating: luasocket-3.0-rc1/doc/
  inflating: luasocket-3.0-rc1/doc/dns.html  
  inflating: luasocket-3.0-rc1/doc/ftp.html  
  inflating: luasocket-3.0-rc1/doc/http.html  
  inflating: luasocket-3.0-rc1/doc/index.html  
  inflating: luasocket-3.0-rc1/doc/installation.html  
  inflating: luasocket-3.0-rc1/doc/introduction.html  
  inflating: luasocket-3.0-rc1/doc/ltn12.html  
  inflating: luasocket-3.0-rc1/doc/lua05.ppt  
  inflating: luasocket-3.0-rc1/doc/luasocket.png  
  inflating: luasocket-3.0-rc1/doc/mime.html  
  inflating: luasocket-3.0-rc1/doc/reference.css  
  inflating: luasocket-3.0-rc1/doc/reference.html  
  inflating: luasocket-3.0-rc1/doc/smtp.html  
  inflating: luasocket-3.0-rc1/doc/socket.html  
  inflating: luasocket-3.0-rc1/doc/tcp.html  
  inflating: luasocket-3.0-rc1/doc/udp.html  
  inflating: luasocket-3.0-rc1/doc/url.html  
   creating: luasocket-3.0-rc1/etc/
  inflating: luasocket-3.0-rc1/etc/README  
  inflating: luasocket-3.0-rc1/etc/b64.lua  
  inflating: luasocket-3.0-rc1/etc/check-links.lua  
  inflating: luasocket-3.0-rc1/etc/check-memory.lua  
  inflating: luasocket-3.0-rc1/etc/cookie.lua  
  inflating: luasocket-3.0-rc1/etc/dict.lua  
  inflating: luasocket-3.0-rc1/etc/dispatch.lua  
  inflating: luasocket-3.0-rc1/etc/eol.lua  
  inflating: luasocket-3.0-rc1/etc/forward.lua  
  inflating: luasocket-3.0-rc1/etc/get.lua  
  inflating: luasocket-3.0-rc1/etc/links  
  inflating: luasocket-3.0-rc1/etc/lp.lua  
  inflating: luasocket-3.0-rc1/etc/qp.lua  
  inflating: luasocket-3.0-rc1/etc/tftp.lua  
   creating: luasocket-3.0-rc1/gem/
  inflating: luasocket-3.0-rc1/gem/ex1.lua  
  inflating: luasocket-3.0-rc1/gem/ex10.lua  
  inflating: luasocket-3.0-rc1/gem/ex11.lua  
  inflating: luasocket-3.0-rc1/gem/ex12.lua  
  inflating: luasocket-3.0-rc1/gem/ex2.lua  
  inflating: luasocket-3.0-rc1/gem/ex3.lua  
  inflating: luasocket-3.0-rc1/gem/ex4.lua  
  inflating: luasocket-3.0-rc1/gem/ex5.lua  
  inflating: luasocket-3.0-rc1/gem/ex6.lua  
  inflating: luasocket-3.0-rc1/gem/ex7.lua  
  inflating: luasocket-3.0-rc1/gem/ex8.lua  
  inflating: luasocket-3.0-rc1/gem/ex9.lua  
  inflating: luasocket-3.0-rc1/gem/gem.c  
  inflating: luasocket-3.0-rc1/gem/gt.b64  
  inflating: luasocket-3.0-rc1/gem/input.bin  
  inflating: luasocket-3.0-rc1/gem/ltn012.tex  
  inflating: luasocket-3.0-rc1/gem/luasocket.png  
  inflating: luasocket-3.0-rc1/gem/makefile  
  inflating: luasocket-3.0-rc1/gem/myps2pdf  
  inflating: luasocket-3.0-rc1/gem/t1.lua  
  inflating: luasocket-3.0-rc1/gem/t1lf.txt  
  inflating: luasocket-3.0-rc1/gem/t2.lua  
  inflating: luasocket-3.0-rc1/gem/t2.txt  
  inflating: luasocket-3.0-rc1/gem/t2gt.qp  
  inflating: luasocket-3.0-rc1/gem/t3.lua  
  inflating: luasocket-3.0-rc1/gem/t4.lua  
  inflating: luasocket-3.0-rc1/gem/t5.lua  
  inflating: luasocket-3.0-rc1/gem/test.lua  
  inflating: luasocket-3.0-rc1/linux.cmd  
  inflating: luasocket-3.0-rc1/logo.ps  
  inflating: luasocket-3.0-rc1/ltn012.wiki  
  inflating: luasocket-3.0-rc1/ltn013.wiki  
  inflating: luasocket-3.0-rc1/luasocket-scm-0.rockspec  
  inflating: luasocket-3.0-rc1/luasocket.sln  
  inflating: luasocket-3.0-rc1/macosx.cmd  
  inflating: luasocket-3.0-rc1/makefile  
  inflating: luasocket-3.0-rc1/makefile.dist  
  inflating: luasocket-3.0-rc1/mime.vcxproj  
  inflating: luasocket-3.0-rc1/mime.vcxproj.filters  
  inflating: luasocket-3.0-rc1/mingw.cmd  
   creating: luasocket-3.0-rc1/samples/
  inflating: luasocket-3.0-rc1/samples/README  
  inflating: luasocket-3.0-rc1/samples/cddb.lua  
  inflating: luasocket-3.0-rc1/samples/daytimeclnt.lua  
  inflating: luasocket-3.0-rc1/samples/echoclnt.lua  
  inflating: luasocket-3.0-rc1/samples/echosrvr.lua  
  inflating: luasocket-3.0-rc1/samples/listener.lua  
  inflating: luasocket-3.0-rc1/samples/lpr.lua  
  inflating: luasocket-3.0-rc1/samples/mclisten.lua  
  inflating: luasocket-3.0-rc1/samples/mcsend.lua  
  inflating: luasocket-3.0-rc1/samples/talker.lua  
  inflating: luasocket-3.0-rc1/samples/tinyirc.lua  
  inflating: luasocket-3.0-rc1/socket.vcxproj  
  inflating: luasocket-3.0-rc1/socket.vcxproj.filters  
   creating: luasocket-3.0-rc1/src/
  inflating: luasocket-3.0-rc1/src/auxiliar.c  
  inflating: luasocket-3.0-rc1/src/auxiliar.h  
  inflating: luasocket-3.0-rc1/src/buffer.c  
  inflating: luasocket-3.0-rc1/src/buffer.h  
  inflating: luasocket-3.0-rc1/src/except.c  
  inflating: luasocket-3.0-rc1/src/except.h  
  inflating: luasocket-3.0-rc1/src/ftp.lua  
  inflating: luasocket-3.0-rc1/src/headers.lua  
  inflating: luasocket-3.0-rc1/src/http.lua  
  inflating: luasocket-3.0-rc1/src/inet.c  
  inflating: luasocket-3.0-rc1/src/inet.h  
  inflating: luasocket-3.0-rc1/src/io.c  
  inflating: luasocket-3.0-rc1/src/io.h  
  inflating: luasocket-3.0-rc1/src/ltn12.lua  
  inflating: luasocket-3.0-rc1/src/luasocket.c  
  inflating: luasocket-3.0-rc1/src/luasocket.h  
  inflating: luasocket-3.0-rc1/src/makefile  
  inflating: luasocket-3.0-rc1/src/mbox.lua  
  inflating: luasocket-3.0-rc1/src/mime.c  
  inflating: luasocket-3.0-rc1/src/mime.h  
  inflating: luasocket-3.0-rc1/src/mime.lua  
  inflating: luasocket-3.0-rc1/src/options.c  
  inflating: luasocket-3.0-rc1/src/options.h  
  inflating: luasocket-3.0-rc1/src/select.c  
  inflating: luasocket-3.0-rc1/src/select.h  
  inflating: luasocket-3.0-rc1/src/serial.c  
  inflating: luasocket-3.0-rc1/src/smtp.lua  
  inflating: luasocket-3.0-rc1/src/socket.h  
  inflating: luasocket-3.0-rc1/src/socket.lua  
  inflating: luasocket-3.0-rc1/src/tcp.c  
  inflating: luasocket-3.0-rc1/src/tcp.h  
  inflating: luasocket-3.0-rc1/src/timeout.c  
  inflating: luasocket-3.0-rc1/src/timeout.h  
  inflating: luasocket-3.0-rc1/src/tp.lua  
  inflating: luasocket-3.0-rc1/src/udp.c  
  inflating: luasocket-3.0-rc1/src/udp.h  
  inflating: luasocket-3.0-rc1/src/unix.c  
  inflating: luasocket-3.0-rc1/src/unix.h  
  inflating: luasocket-3.0-rc1/src/url.lua  
  inflating: luasocket-3.0-rc1/src/usocket.c  
  inflating: luasocket-3.0-rc1/src/usocket.h  
  inflating: luasocket-3.0-rc1/src/wsocket.c  
  inflating: luasocket-3.0-rc1/src/wsocket.h  
   creating: luasocket-3.0-rc1/test/
  inflating: luasocket-3.0-rc1/test/README  
   creating: luasocket-3.0-rc1/test/auth/
 extracting: luasocket-3.0-rc1/test/auth/.htpasswd  
  inflating: luasocket-3.0-rc1/test/auth/index.html  
   creating: luasocket-3.0-rc1/test/cgi/
  inflating: luasocket-3.0-rc1/test/cgi/cat  
  inflating: luasocket-3.0-rc1/test/cgi/cat-index-html  
  inflating: luasocket-3.0-rc1/test/cgi/env  
  inflating: luasocket-3.0-rc1/test/cgi/query-string  
  inflating: luasocket-3.0-rc1/test/cgi/redirect-loop  
  inflating: luasocket-3.0-rc1/test/cgi/request-uri  
  inflating: luasocket-3.0-rc1/test/dicttest.lua  
  inflating: luasocket-3.0-rc1/test/excepttest.lua  
  inflating: luasocket-3.0-rc1/test/find-connect-limit  
  inflating: luasocket-3.0-rc1/test/ftptest.lua  
  inflating: luasocket-3.0-rc1/test/hello.lua  
  inflating: luasocket-3.0-rc1/test/httptest.lua  
  inflating: luasocket-3.0-rc1/test/index.html  
  inflating: luasocket-3.0-rc1/test/ltn12test.lua  
  inflating: luasocket-3.0-rc1/test/luasocket.png  
  inflating: luasocket-3.0-rc1/test/mimetest.lua  
  inflating: luasocket-3.0-rc1/test/smtptest.lua  
  inflating: luasocket-3.0-rc1/test/stufftest.lua  
  inflating: luasocket-3.0-rc1/test/tcp-getoptions  
  inflating: luasocket-3.0-rc1/test/test_bind.lua  
  inflating: luasocket-3.0-rc1/test/test_getaddrinfo.lua  
  inflating: luasocket-3.0-rc1/test/test_socket_error.lua  
  inflating: luasocket-3.0-rc1/test/testclnt.lua  
  inflating: luasocket-3.0-rc1/test/testmesg.lua  
  inflating: luasocket-3.0-rc1/test/testsrvr.lua  
  inflating: luasocket-3.0-rc1/test/testsupport.lua  
  inflating: luasocket-3.0-rc1/test/tftptest.lua  
  inflating: luasocket-3.0-rc1/test/udp-zero-length-send  
  inflating: luasocket-3.0-rc1/test/udp-zero-length-send-recv  
  inflating: luasocket-3.0-rc1/test/udpconnectclnt.lua  
  inflating: luasocket-3.0-rc1/test/udpconnectsrvr.lua  
  inflating: luasocket-3.0-rc1/test/unixclnt.lua  
  inflating: luasocket-3.0-rc1/test/unixsrvr.lua  
  inflating: luasocket-3.0-rc1/test/upload.html  
  inflating: luasocket-3.0-rc1/test/urltest.lua  
  inflating: luasocket-3.0-rc1/test/utestclnt.lua  
  inflating: luasocket-3.0-rc1/test/utestsrvr.lua  
  inflating: luasocket-3.0-rc1/win32.cmd  
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/mime.c -o src/mime.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -bundle -undefined dynamic_lookup -all_load -o mime/core.so -L/usr/local/lib src/mime.o
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/buffer.c -o src/buffer.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/auxiliar.c -o src/auxiliar.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/options.c -o src/options.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/timeout.c -o src/timeout.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/io.c -o src/io.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/usocket.c -o src/usocket.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/unix.c -o src/unix.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -bundle -undefined dynamic_lookup -all_load -o socket/unix.so -L/usr/local/lib src/buffer.o src/auxiliar.o src/options.o src/timeout.o src/io.o src/usocket.o src/unix.o
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/luasocket.c -o src/luasocket.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/timeout.c -o src/timeout.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/buffer.c -o src/buffer.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/io.c -o src/io.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/auxiliar.c -o src/auxiliar.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/options.c -o src/options.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/inet.c -o src/inet.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/except.c -o src/except.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/select.c -o src/select.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/tcp.c -o src/tcp.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/udp.c -o src/udp.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/usocket.c -o src/usocket.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -bundle -undefined dynamic_lookup -all_load -o socket/core.so -L/usr/local/lib src/luasocket.o src/timeout.o src/buffer.o src/io.o src/auxiliar.o src/options.o src/inet.o src/except.o src/select.o src/tcp.o src/udp.o src/usocket.o
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/buffer.c -o src/buffer.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/auxiliar.c -o src/auxiliar.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/options.c -o src/options.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/timeout.c -o src/timeout.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/io.c -o src/io.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/usocket.c -o src/usocket.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c src/serial.c -o src/serial.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -bundle -undefined dynamic_lookup -all_load -o socket/serial.so -L/usr/local/lib src/buffer.o src/auxiliar.o src/options.o src/timeout.o src/io.o src/usocket.o src/serial.o
Updating manifest for /usr/local/lib/luarocks/rocks-5.2
luasocket 3.0rc1-2 is now built and installed in /usr/local (license: MIT)

[ye@Yes-MacBook-Pro raven-lua (master)]$ make test
Loaded testsuite with 12 tests in 3 testcases.

    ..........[ERROR]   Failed to send to Sentry:   connection refused      {"culprit":"error","timestamp":"2016-03-30T19:25:54","message":"tests\/test_exceptions.lua:28: bad","server_name":"undefined","level":"error","logger":"root","event_id":"5ad325c251004f2d8fb684c63844c357","platform":"lua","exception":[{"value":"tests\/test_exceptions.lua:28: bad","stacktrace":{"frames":[{"filename":"[C]","lineno":-1},{"filename":"stdin","lineno":11},{"filename":"\/usr\/local\/share\/lua\/5.2\/lunit.lua","lineno":540},{"filename":"\/usr\/local\/share\/lua\/5.2\/lunit.lua","lineno":522,"function":"runtest"},{"filename":"\/usr\/local\/share\/lua\/5.2\/lunit.lua","lineno":504,"function":"callit"},{"filename":"\/usr\/local\/share\/lua\/5.2\/lunit.lua","lineno":108,"function":"mypcall"},{"filename":"[C]","lineno":-1,"function":"xpcall"},{"filename":"tests\/test_exceptions.lua","lineno":28},{"filename":"[C]","lineno":-1,"function":"xpcall"},{"filename":"tests\/test_exceptions.lua","lineno":28},{"filename":"[C]","lineno":-1,"function":"error"}]}}]}
.[ERROR]    Failed to send to Sentry:   connection refused      {"culprit":"tests\/test_exceptions.lua:17","timestamp":"2016-03-30T19:25:54","message":"IF YOU ARE READING THIS IT IS CORRECT; THIS TEST SHOULD GENERATE AN ERROR.","server_name":"undefined","level":"error","logger":"root","event_id":"5b8279bfc3d64efb8c5cf3446cfaa291","platform":"lua"}
.

60 Assertions checked.

Testsuite finished (12 passed, 0 failed, 0 errors).

Allow use of cjson alternative

For platforms where cjson is not available (eg. Control4) an alternative JSON implementation is required. Obviously cjson support must be maintained, but I think loading json when loading cjson fails is a good solution.

I have tested with https://github.com/rxi/json.lua and it seems to work.

I have a PR to fix this: #42

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.