Code Monkey home page Code Monkey logo

erlang-syslog's People

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

Watchers

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

erlang-syslog's Issues

Can repeatably crash Erlang

Summary

The code below will crash the emulator in R15B01 i386 and x86_64. I've repeated this on Debian 6.0.5 (64-bit), CentOS 6.3 (32-bit), and Ubuntu 12.04 (64-bit). I haven't tried other distros or versions of Erlang.

-module(crash_syslog).
-compile([export_all]).

boom() ->
    {ok, _Pid} = syslog:start(),
    syslog:open("Beuha", [cons, perror, pid], local0),
    syslog:log(err, "Damned"),
    syslog:open(foo, [cons, perror, pid], local0),
    io:format("Erlang is now going to crash~n", []),
    syslog:open("Beuha", [cons, perror, pid], local0),
    io:format("Ok, I lied.~n", []),
    ok.

Installing and running

$ git clone git://github.com/Vagabond/erlang-syslog.git
Initialized empty Git repository in /tmp/erlang-syslog/.git/
remote: Counting objects: 94, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 94 (delta 45), reused 71 (delta 31)
Receiving objects: 100% (94/94), 92.75 KiB, done.
Resolving deltas: 100% (45/45), done.
$ cd erlang-syslog/
$ ./rebar compile
==> erlang-syslog (compile)
Compiled src/syslog_app.erl
Compiled src/syslog_sup.erl
Compiled src/syslog.erl
Compiling c_src/syslog_drv.c
$ sudo ./rebar install
==> erlang-syslog (install)
Installing: syslog-0.0.1 to /usr/lib/erlang/lib
$ erlc crash_syslog.erl 
$ erl -s crash_syslog boom
Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

Erlang is now going to crash
*** glibc detected *** /usr/lib/erlang/erts-5.9.1/bin/beam.smp: double free or corruption (fasttop): 0xb3704480 ***

Environment

I've listed hopefully all info needed.

CentOS

$ lsb_release -a
LSB Version:    :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.3 (Final)
Release:    6.3
Codename:   Final

$ gcc --version
gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)

$ erl
Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

Debian

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 6.0.5 (squeeze)
Release:    6.0.5
Codename:   squeeze

$ gcc --version
gcc (Debian 4.4.5-8) 4.4.5

$ erl
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [kernel-poll:false]

Ubuntu

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.1 LTS
Release:    12.04
Codename:   precise
$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
$ erl
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]

#012 printed instead of endline with ~p formatted iolists

Str = io_lib:format("~p", [lists:seq(1,100)]),
syslog:log(info, Str).

Expected: Pretty print of term matches what is printed in the shell.
1> io:format("pn", [lists:seq(1,100)]).
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,
29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,
54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,
79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]
ok
2>

Actual: Where newlines are printed in the shell, #12 is printed instead, and all on one line.
Mar 2 14:55:50 thinky64 apps@thinky64[28937]: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,#12 16,17,18,19,20,21,22,23,24,25,26,27,#12 28,29,30,31,32,33,34,35,36,37,38,39,#12 40,41,42,43,44,45,46,47,48,49,50,51,#12 52,53,54,55,56,57,58,59,60,61,62,63,#12 64,65,66,67,68,69,70,71,72,73,74,75,#12 76,77,78,79,80,81,82,83,84,85,86,87,#12 88,89,90,91,92,93,94,95,96,97,98,99,#12 100]

Don't use git protocol to download pc plugin

In the rebar config file the pc plugin section is written like this:

{plugins, [
  { pc, { git, "git://github.com/blt/port_compiler.git", {tag, "1.6.0"}}}
]}.

However, my employer's network blocks git connections. I've looked at other packages and they seem to always use https to fetch GitHub repos. So I think the plugins section should be changed like this so that it works on networks that are hostile to git connections:

{plugins, [
  { pc, { git, "https://github.com/blt/port_compiler.git", {tag, "1.6.0"}}}
]}.

After making this change locally I was able to compile the syslog package.

Add an explicit license

This project doesn't have a license file. Could you add one to clarify the licensing terms, please?

Can't compile on OTP 24

➜  mix compile
===> Analyzing applications...
===> Compiling syslog
===> Missing artifact priv/syslog_drv.so
** (Mix) Could not compile dependency :syslog, "/home/alex/.mix/rebar3 bare compile --paths /home/alex/Projects/soapbox/_build/dev/lib/*/ebin" command failed. You can recompile this dependency with "mix deps.compile syslog", update it with "mix deps.update syslog" or clean it with "mix deps.clean syslog"

I upgraded to OTP 24 and can't seem to compile syslog anymore.

What is priv/syslog_drv.so?

Linked issues:

wedges system

I'm pretty sure I must be doing something wrong, but this code makes my system hang when I try and run it:

syslog:start(). 
{ok,<0.195.0>}
([email protected])2> 
([email protected])2> {ok,Log} = syslog:open("erlsyslog", [cons, perror, pid], user).  

At this point it just hangs. I tracked things down in the C code to where it does this:

        nd->port = driver_create_port(port, pid, DRV_NAME, data);

But I have no idea what it locks up there. I suspect I'm doing something wrong, but it'd be nice if I got a gentle message rather than a hung system.

Is the package broken with the latest rebar?

I don't know if something has changed recently in rebar3 but currently it's not possible to get this working. Basically it cannot generate the syslog_drv.so driver. I've tried with different versions of elixir (1.6 / 1.10) but the result is the same.

In my case it's failing silently when compiling it as a dependency of ex_syslogger, it crashes when starting the application saying it could not found the syslog_drv driver. This looks like something similar to what is reported in this Pull Request: #36

Improvement on build script

Please improve or write instruction on building this module.
Ideally when compile riak, it will be nice to see it as one go rather than hunting down errors that are not contributing to try using Riak. Riak depends on erlang-syslog and when compiling it cannot find the erl_interface.h file, which I need to set it manually.
Is it possible to probe for it in the build script in future?

Error.
ompiling /opt/riak/deps/syslog/c_src/syslog_drv.c
/opt/riak/deps/syslog/c_src/syslog_drv.c:30:24: error: erl_driver.h: No such file or directory
/opt/riak/deps/syslog/c_src/syslog_drv.c:45: error: expected specifier-qualifier-list before ‘ErlDrvPort’
/opt/riak/deps/syslog/c_src/syslog_drv.c: In function ‘encode_error’:
/opt/riak/deps/syslog/c_src/syslog_drv.c:60: error: ‘ERL_DRV_ERROR_GENERAL’ undeclared (first use in this function)

rebar2 get-deps fails

Hi, this commit 964310d breaks dependency compilation with rebar2

rebar version
rebar 2.6.4 17 20160926_070944 git 2.6.4-4-g576e121  

rebar get-deps

...

==> lager_syslog (get-deps)
Pulling syslog from {git,"git://github.com/Vagabond/erlang-syslog",
                         {branch,"master"}}
Cloning into 'syslog'...
Uncaught error in rebar_core: {'EXIT',
                               {function_clause,
                                [{code,which,
                                  [{pc,
                                    {git,
                                     "[email protected]:blt/port_compiler.git",
                                     {branch,"master"}}}],
                                  [{file,"code.erl"},{line,719}]},
                                 {rebar_core,'-plugin_modules/3-lc$^0/1-0-',
                                  1,
                                  [{file,"src/rebar_core.erl"},{line,573}]},
                                 {rebar_core,plugin_modules,3,
                                  [{file,"src/rebar_core.erl"},{line,573}]},
                                 {rebar_core,process_dir1,7,
                                  [{file,"src/rebar_core.erl"},{line,244}]},
                                 {rebar_core,process_each,5,
                                  [{file,"src/rebar_core.erl"},{line,351}]},
                                 {rebar_core,process_dir1,7,
                                  [{file,"src/rebar_core.erl"},{line,271}]},
                                 {rebar_core,process_each,5,
                                  [{file,"src/rebar_core.erl"},{line,351}]},

To re-produce problem you can try to build this app
https://github.com/esl/MongooseIM

mkdir -p /tmp/mongooseim \
&& cd /tmp/mongooseim \
&& git clone [email protected]:esl/MongooseIM.git . \
&& ./tools/configure \
&& make rel

When adding dependency to this commit e24c9ee in rebar.config

{syslog, ".*", {git, "git://github.com/Vagabond/erlang-syslog", "e24c9ee"}}

rebar get-deps works good.

syslog module doesn't recover after an error

Hi.

If i send a one bad message(in my case unicode string instead of utf8 string), then all messages after that get me a "bad argument" error despite the fact that they are correct:

15> {ok, Logh} = syslog:open("test", [pid], local1).
{ok,#Port<0.1838>}
16> syslog:log(Logh, info, "ascii message").        
ok
17> syslog:log(Logh, info, <<"ascii message">>).
ok
18> syslog:log(Logh, info, unicode:characters_to_binary("utf8 сообщение")).
ok
19> syslog:log(Logh, info, "utf8 сообщение").                              

=ERROR REPORT==== 17-Nov-2015::11:25:21 ===
Bad value on output port 'syslog_drv'

** exception error: bad argument
     in function  port_command/2
        called as port_command(#Port<0.1838>,
                               [<<0,0,0,6>>,
                                [117,116,102,56,32,1089,1086,1086,1073,1097,1077,1085,1080,
                                 1077],
                                <<0>>])
     in call from syslog:log/3 (src/syslog.erl, line 127)
20> syslog:log(Logh, info, unicode:characters_to_binary("utf8 сообщение")).
** exception error: bad argument
     in function  port_command/2
        called as port_command(#Port<0.1838>,
                               [<<0,0,0,6>>,
                                <<117,116,102,56,32,209,129,208,190,208,190,208,177,209,
                                  137,208,181,208,189,208,184,208,181>>,
                                <<0>>])
     in call from syslog:log/3 (src/syslog.erl, line 127)
21> syslog:log(Logh, info, <<"ascii message">>).                           
** exception error: bad argument
     in function  port_command/2
        called as port_command(#Port<0.1838>,[<<0,0,0,6>>,<<"ascii message">>,<<0>>])
     in call from syslog:log/3 (src/syslog.erl, line 127)
22> syslog:log(Logh, info, "ascii message").                               
** exception error: bad argument
     in function  port_command/2
        called as port_command(#Port<0.1838>,[<<0,0,0,6>>,"ascii message",<<0>>])
     in call from syslog:log/3 (src/syslog.erl, line 127)

Can syslog module automatically recover in this situation? It would be great if syslog module keeps
a working state despite a one bad message.

Thanks!

copy files will "Segmentation fault (core dumped)"

The application is running in "~/sanguo/trunk/server/deps/syslog".
Then execute "cp -r server/deps/syslog ~/sanguo/trunk/server/deps/"
And call erlang-syslog, it will "Segmentation fault (core dumped)", And the Erlang node will be terminated.

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.