Loïc Hoguin | 14 Jul 15:14 2016
Picon
Gravatar

Problem with -pa and code:priv_dir

Hello,

I can't seem to be able to log in with Github to bugs.erlang.org, I get 
this:

OpenID Failed
Github returned 'redirect_uri_mismatch, The redirect_uri MUST match the 
registered callback URL for this application., 
https://developer.github.com/v3/oauth/#redirect-uri-mismatch, 
05ff145b-bfa8-4152-88a0-b4cce9de3d48' which suggests an invalid 
configuration, please check if Client ID and Client Secret match with 
those offered by Github.

So I am posting this issue here instead:

I run into an issue when using -pa and code:priv_dir/1 with Erlang 19.0. 
An example is worth a thousand words:

$ erl -pa ./test_c_src_nif/ebin
Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] [async-threads:10] 
[hipe] [kernel-poll:false]

Eshell V8.0  (abort with ^G)
1> code:priv_dir(test_c_src_nif).
"./test_c_src_nif/priv"

$ erl -pa test_c_src_nif/ebin
Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] [async-threads:10] 
[hipe] [kernel-poll:false]

(Continue reading)

Leo Liu | 8 Jul 17:26 2016
Face
Picon
Gravatar

erl_eval:expr/5 oddity

Assume X is

{'if',1,
      [{clause,1,[],
               [[{op,1,'=:=',{var,1,'Filters'},{nil,1}}]],
               [{atom,1,true}]},
       {clause,1,[],[[{atom,1,true}]],[{atom,1,false}]}]}

which is the abstract format for

  if Filters =:= [] -> true; true -> false end.

1> erl_eval:expr(X, [], none, none, none).
=> false

2) erl_eval:expr(X, [])
=> ** exception error: {unbound_var,'Filters'}

bug?

Leo

_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs

Daniel Goertzen | 13 Jun 22:45 2016
Picon

No string escaping for SNMP config files

Config files written by the SNMP application lack string escaping as shown in the example below.  This goes especially badly when there's a quote character in the string (config file becomes unreadable).  I plan on doing a PR for this, but I thought I'd mention it here first.

-sh-4.3# cat agent.conf 
%% This file was generated by snmpa_conf (version-5.2) 2016-05-26 ...

{intAgentIpAddress, [0,0,0,0]}.
{intAgentUDPPort, 161}.
{snmpEngineMaxMessageSize, 484}.
{snmpEngineID, "�c�0"$Ԟ"}.

_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Loïc Hoguin | 5 Jun 15:44 2016
Picon
Gravatar

Tiny documentation bug

Hello,

It seems the docs incorrectly count the number of arguments to functions 
in some cases, for example this one:

  http://erlang.org/doc/man/httpd_util.html#rfc1123_date-2

The URL and the link description in the sidebar are both wrong, since 
this function only takes one argument. The issue also appears in the doc 
search, where it returns httpd_util:rfc1123_date/2 instead of /1.

Cheers,

--

-- 
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Garret Smith | 3 Jun 21:43 2016
Picon

R19-rc2 compilation error on FreeBSD 10.3-p4 in unix_efile

Going back, this error was present in rc1 as well.
I'm on FreeBSD 10.3-p4, trying to compile with both GCC 4.8 and clang
3.4.  I get the same error with both compilers

compile command (clang)

./otp_build setup -a --prefix=/home/gsmith
--with-wx-config=/usr/local/bin/wxgtk2u-3.0-config

compile command (gcc)

env CC=gcc48 CXX=g++48 ./otp_build setup -a --prefix=/home/gsmith
--with-wx-config=/usr/local/bin/wxgtk2u-3.0-config

error message:

In file included from beam/sys.h:105:0,
                 from drivers/unix/unix_efile.c:32:
sys/unix/erl_unix_sys.h: In function 'erts_check_fpe_thorough':
sys/unix/erl_unix_sys.h:424:5: error: implicit declaration of function
'finite' [-Werror=implicit-function-declaration]
     return erts_check_fpe(fp_exception, f) || !isfinite(f);
     ^
In file included from beam/erl_threads.h:268:0,
                 from beam/erl_smp.h:28,
                 from beam/sys.h:467,
                 from drivers/unix/unix_efile.c:32:
beam/erl_term.h: At top level:
beam/erl_term.h:57:8: error: #error Hipe on 64-bit needs a real mmap
as it does not support the literal tag
 #      error Hipe on 64-bit needs a real mmap as it does not support
the literal tag
        ^
cc1: some warnings being treated as errors
x86_64-unknown-freebsd10.3/Makefile:697: recipe for target
'obj/x86_64-unknown-freebsd10.3/opt/smp/unix_efile.o' failed

I'll be happy to assist in testing out patches if necessary.

-Garret Smith
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs

Matthew Evans | 29 May 16:21 2016
Picon

beam core file R17

Hi,

This core was found on a live system (R17):

10:16:38:# erl

Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]


Eshell V6.2  (abort with ^G)

1> 



........


May 28 22:18:56 [info   ] plexxi kernel: [1235119.885465] beam.smp[2267] general protection ip:4b698a sp:7faeb6a7d650 error:0 in beam.smp[400000+1ac000]


warning: Can't read pathname for load map: Input/output error.

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/libthread_db.so.1".

Core was generated by `/usr/lib/erlang/erts-6.2/bin/beam.smp -K true -A 24 -P 350000 -- -root /usr/lib'.

Program terminated with signal 11, Segmentation fault.

#0  0x00000000004b698a in sweep_off_heap ()

(gdb) bt

#0  0x00000000004b698a in sweep_off_heap ()

#1  0x00000000004b77d1 in do_minor ()

#2  0x00000000004b8479 in erts_garbage_collect ()

#3  0x00000000004e1374 in process_main ()

#4  0x000000000048071d in sched_thread_func ()

#5  0x0000000000549f89 in thr_wrapper ()

#6  0x00007faeba32ba30 in start_thread () from /lib/libpthread.so.0

#7  0x00007faeb9e8a53d in clone () from /lib/libc.so.6

(gdb) up

_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Ulf Norell | 19 May 11:00 2016

R19-rc1: Internal error in beam_type

On R19 rc1 (OTP-19.0-rc1 tag in git) the following module causes an internal error when compiled:

-module(bug).

-compile(export_all).

f(pat) ->
  X = case err of
         ok  -> ok;
         err -> external:call(), 0
      end,
  case X of
    ok  -> ok;
    err -> err;
    0   -> bad
  end.

The error is:

bug.erl: internal error in beam_type;
crash reason: {case_clause,
    {'EXIT',
        {function_clause,
            [{beam_type,simplify_select_val_int,
                 [{select,select_val,
                      {x,0},
                      {f,7},
                      [{atom,ok},{f,10},{atom,err},{f,9}]},
                  0],
                 [{file,"beam_type.erl"},{line,169}]},
             {beam_type,simplify_basic_1,3,
                 [{file,"beam_type.erl"},{line,155}]},
             {beam_type,opt,3,[{file,"beam_type.erl"},{line,57}]},
             {beam_type,function,1,[{file,"beam_type.erl"},{line,36}]},
             {beam_type,'-module/2-lc$^0/1-0-',1,
                 [{file,"beam_type.erl"},{line,30}]},
             {beam_type,module,2,[{file,"beam_type.erl"},{line,30}]},
             {compile,'-select_passes/2-anonymous-2-',2,
                 [{file,"compile.erl"},{line,521}]},
             {compile,'-internal_comp/4-anonymous-1-',2,
                 [{file,"compile.erl"},{line,306}]}]}}}

  in function  compile:'-select_passes/2-anonymous-2-'/2 (compile.erl, line 521)
  in call from compile:'-internal_comp/4-anonymous-1-'/2 (compile.erl, line 306)
  in call from compile:fold_comp/3 (compile.erl, line 332)
  in call from compile:internal_comp/4 (compile.erl, line 316)
  in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line 166)

/ Ulf
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Rob A'Court | 21 Apr 12:45 2016

Issue using variable length fields with Erlang ODBC

When querying variable length fields using ODBC in Erlang, the response returned seems to be gibberish. I’ve posted this on the questions board and it has been suggested that this is a real bug.

 

We can query tables in a MS SQL Server database but if the table contains a VarCharMax or NVarCharMax field (both variable length) then the result returned is not what we expect. For NVarCharMax a binary is returned which has part of the original query and other seemingly random data as if it’s the wrong area of memory. For VarCharMax an empty list is always returned.

 

In our particular scenario we are trying to get a ShowPlanXML from MS SQL Server which comes back as a NVarCharMax and there is no way of converting it to a fixed length field type to work around the issue.

 

The issue does not seem to be with the ODBC driver as trying the same thing in python works fine.

 

Here is what we are trying to do in Elixir:

 

:odbc.start

{:ok, connection} = :odbc.connect('Driver={ODBC Driver 11 for SQL Server}; Server=TheServer;Uid=sa;Pwd=password;Database=TheDatabase',[])

IO.inspect :odbc.sql_query(connection, 'set showplan_xml on')

IO.inspect :odbc.sql_query(connection, 'Select * from customers'), limit: 9000

 

 

Here is the equivalent in python that works fine:

 

#!/usr/bin/env python

import pyodbc

conn = pyodbc.connect('Driver={ODBC Driver 11 for SQL Server}; Server=TheServer;Uid=sa;Pwd=password;Database=TheDatabase')

cur = conn.cursor()

cur.execute('set showplan_xml on')

cur.execute('Select * from customers')

 

for row in cur :

  print row     

 

 

Many thanks!

 

Rob

_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Aleksander Nycz | 16 Apr 07:33 2016
Picon

gen_server error report issue

Hello,

I think I've found some problem in gen_server error report:

when terminate callback throw errors then earlier errors (eg. from handle_call callback) is not reported.

Please compile and run provided simple_server.erl module, that implement gen_server behaviour:

(compilation12836 <at> zyndram.krakow.comarch)4> simple_server:start_link(false).
{ok,<0.128.0>}
(compilation12836 <at> zyndram.krakow.comarch)5> simple_server:perform(false).
ok
(compilation12836 <at> zyndram.krakow.comarch)6> simple_server:perform(true).
** exception exit: perform_error_in_handle_call
     in function  simple_server:handle_call/3 (loadController/src/simple_server.erl, line 89)
     in call from gen_server:try_handle_call/4 (gen_server.erl, line 629)
     in call from gen_server:handle_msg/5 (gen_server.erl, line 661)
     in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 240)
(compilation12836 <at> zyndram.krakow.comarch)7>
=ERROR REPORT==== 16-Mar-2016::15:36:35 ===
** Generic server simple_server terminating
** Last message in was {perform,true}
** When Server state == {state,false}
** Reason for termination ==
** {perform_error_in_handle_call,
       [{simple_server,handle_call,3,
            [{file,"loadController/src/simple_server.erl"},{line,89}]},
        {gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,629}]},
        {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,661}]},
        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}

In this case we can see that exception was thrown 'in function  simple_server:handle_call/3 (loadController/src/simple_server.erl, line 89)'

And now please start server in this way:

(compilation12836 <at> zyndram.krakow.comarch)7> simple_server:start_link(true).
{ok,<0.133.0>}
(compilation12836 <at> zyndram.krakow.comarch)8> simple_server:perform(false).
ok
(compilation12836 <at> zyndram.krakow.comarch)9> simple_server:perform(true).

=ERROR REPORT==== 16-Mar-2016::15:37:30 ===
** Generic server simple_server terminating
** Last message in was {perform,true}
** When Server state == {state,true}
** Reason for termination ==
** {throw_error_in_terminate_callback,
       [{simple_server,terminate,2,
            [{file,"loadController/src/simple_server.erl"},{line,141}]},
        {gen_server,try_terminate,3,[{file,"gen_server.erl"},{line,643}]},
        {gen_server,terminate,7,[{file,"gen_server.erl"},{line,809}]},
        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}
** exception exit: throw_error_in_terminate_callback
     in function  simple_server:terminate/2 (loadController/src/simple_server.erl, line 141)
     in call from gen_server:try_terminate/3 (gen_server.erl, line 643)
     in call from gen_server:terminate/7 (gen_server.erl, line 809)
     in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 240)

Now gen_server is also terminating, but we can only see exception from terminate callback.

Exception that causes gen_server termination is not reported.
I rather expect that both exceptions will be shown.


Regards
Aleksander Nycz


-- Aleksander Nycz Chief Designer Telco_021 BSS R&D Comarch SA Phone: +48 17 785 5909 Mobile: +48 691 464 275 website: www.comarch.pl
%%%-------------------------------------------------------------------
%%%  <at> author ANycz
%%%  <at> copyright (C) 2016, <COMPANY>
%%%  <at> doc
%%%
%%%  <at> end
%%% Created : 16. mar 2016 15:30
%%%-------------------------------------------------------------------
-module(simple_server).
-author("ANycz").

-behaviour(gen_server).

%% API
-export([start_link/1, perform/1]).

%% gen_server callbacks
-export([init/1,
    handle_call/3,
    handle_cast/2,
    handle_info/2,
    terminate/2,
    code_change/3]).

-define(SERVER, ?MODULE).

-record(state, {throw_error_in_terminate_callback :: boolean()}).

%%%===================================================================
%%% API
%%%===================================================================


perform(ThrowError) ->
    gen_server:call(?MODULE, {perform, ThrowError})
.

%%--------------------------------------------------------------------
%%  <at> doc
%% Starts the server
%%
%%  <at> end
%%--------------------------------------------------------------------
-spec(start_link(ThrowError::boolean) ->
    {ok, Pid :: pid()} | ignore | {error, Reason :: term()}).
start_link(ThrowError) ->
    gen_server:start_link({local, ?SERVER}, ?MODULE, ThrowError, []).

%%%===================================================================
%%% gen_server callbacks
%%%===================================================================

%%--------------------------------------------------------------------
%%  <at> private
%%  <at> doc
%% Initializes the server
%%
%%  <at> spec init(Args) -> {ok, State} |
%%                     {ok, State, Timeout} |
%%                     ignore |
%%                     {stop, Reason}
%%  <at> end
%%--------------------------------------------------------------------
-spec(init(Args :: term()) ->
    {ok, State :: #state{}} | {ok, State :: #state{}, timeout() | hibernate} |
    {stop, Reason :: term()} | ignore).
init(ThrowError) ->
    {ok, #state{throw_error_in_terminate_callback = ThrowError}}.

%%--------------------------------------------------------------------
%%  <at> private
%%  <at> doc
%% Handling call messages
%%
%%  <at> end
%%--------------------------------------------------------------------
-spec(handle_call(Request :: term(), From :: {pid(), Tag :: term()},
    State :: #state{}) ->
    {reply, Reply :: term(), NewState :: #state{}} |
    {reply, Reply :: term(), NewState :: #state{}, timeout() | hibernate} |
    {noreply, NewState :: #state{}} |
    {noreply, NewState :: #state{}, timeout() | hibernate} |
    {stop, Reason :: term(), Reply :: term(), NewState :: #state{}} |
    {stop, Reason :: term(), NewState :: #state{}}).

handle_call({perform, false}, _From, State) ->
    {reply, ok, State};
handle_call({perform, true}, _From, State) ->
    erlang:error(perform_error_in_handle_call),
    {reply, ok, State};
handle_call(_Request, _From, State) ->
    {reply, ok, State}.

%%--------------------------------------------------------------------
%%  <at> private
%%  <at> doc
%% Handling cast messages
%%
%%  <at> end
%%--------------------------------------------------------------------
-spec(handle_cast(Request :: term(), State :: #state{}) ->
    {noreply, NewState :: #state{}} |
    {noreply, NewState :: #state{}, timeout() | hibernate} |
    {stop, Reason :: term(), NewState :: #state{}}).
handle_cast(_Request, State) ->
    {noreply, State}.

%%--------------------------------------------------------------------
%%  <at> private
%%  <at> doc
%% Handling all non call/cast messages
%%
%%  <at> spec handle_info(Info, State) -> {noreply, State} |
%%                                   {noreply, State, Timeout} |
%%                                   {stop, Reason, State}
%%  <at> end
%%--------------------------------------------------------------------
-spec(handle_info(Info :: timeout() | term(), State :: #state{}) ->
    {noreply, NewState :: #state{}} |
    {noreply, NewState :: #state{}, timeout() | hibernate} |
    {stop, Reason :: term(), NewState :: #state{}}).
handle_info(_Info, State) ->
    {noreply, State}.

%%--------------------------------------------------------------------
%%  <at> private
%%  <at> doc
%% This function is called by a gen_server when it is about to
%% terminate. It should be the opposite of Module:init/1 and do any
%% necessary cleaning up. When it returns, the gen_server terminates
%% with Reason. The return value is ignored.
%%
%%  <at> spec terminate(Reason, State) -> void()
%%  <at> end
%%--------------------------------------------------------------------
-spec(terminate(Reason :: (normal | shutdown | {shutdown, term()} | term()),
    State :: #state{}) -> term()).
terminate(_Reason, #state{throw_error_in_terminate_callback = false}) ->
    ok;
terminate(_Reason, #state{throw_error_in_terminate_callback = true}) ->
    erlang:error(throw_error_in_terminate_callback),
    ok.


%%--------------------------------------------------------------------
%%  <at> private
%%  <at> doc
%% Convert process state when code is changed
%%
%%  <at> spec code_change(OldVsn, State, Extra) -> {ok, NewState}
%%  <at> end
%%--------------------------------------------------------------------
-spec(code_change(OldVsn :: term() | {down, term()}, State :: #state{},
    Extra :: term()) ->
    {ok, NewState :: #state{}} | {error, Reason :: term()}).
code_change(_OldVsn, State, _Extra) ->
    {ok, State}.

%%%===================================================================
%%% Internal functions
%%%===================================================================
Attachment (smime.p7s): application/pkcs7-signature, 6675 bytes
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Matt Keenan | 13 Apr 15:46 2016
Picon

math:exp() erlang bug on SPARC

Hi,

Just wanted to report a SPARC specific issue with Erlang.

See discussions:
   https://github.com/rabbitmq/rabbitmq-server/issues/132
   https://groups.google.com/forum/#!topic/rabbitmq-users/Gca8vW52gB8

Only happens on SPARC systems does not occur on X86 architecture.
e.g.:

On s11u3 x86:
1> math:exp(-1162.102134881488).
0.0

On s11u3 SPARC:
1> math:exp(-1162.102134881488).
** exception error: an error occurred when evaluating an arithmetic 
expression in function math:exp/1 called as math:exp(-1162.102134881488)

Both systems are running 64-bit Erlang 17.5 in a 64-bit environment.

Has an issue related to this been posted before ?

cheers

Matt
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs

Heinz Nikolaus Gies | 10 Mar 21:59 2016
Picon
Gravatar

Bug in random seed (definition?) and random:uniform_s/2

This might not be critical any more since seed is deprecated but I encountered a problem with random today when passing in hand crafted seeds.

The definition of a seed is: {integer(), integer(), integer()}

The seed was generated by the method suggested in random:seed:
{erlang:phash2([node()]), erlang:monotonic_time(), erlang:unique_integer()}
This resulted in the seed:

{128631525,-576302453291645741,-576460752303421854}

That seed is valid based on the type specification of seed.

Now entered random:uniform_s/2, by specification it returns a value 1 <= N <= (passed argument) BUT it doesn’t with this seed:

random:uniform_s(10, {128631525,-576302453291645741,-576460752303421854}).
{-1,{23048,-115,-29427}}


Yes I know that  constructing and passing a seed like this is evil,  please don’t get hung on that, it is not my code it’s code I am debugging - I fully agree that it probably should be changed to rand and be done with it, still it looks is a bug.

Cheers,
Heinz

_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs

Gmane