Mattias Waldau | 27 Nov 11:21 2014

Minor issue: dialyzer on ARM: Compiling some key modules to native code => Illegal instruction (core dumped)

Hi,

I found the --no_native flag, so dialyzer is working nicely. I just 
wanted to report this.

I made build from src. Downloaded zip from github today (2014-11-27). I 
have run the test suite, no complaints.

Thanks,

Mattias

Ps. I am playing with Erlang on a ARM Chromebook with crouton system 
(Samsung Chome 2,for $200). Very usable. About half speed of this Exynos 
5 Octa 1.9GHz compared to a Intel Core i5-2450, 2.4 Ghz.
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs

Anton Ryabkov | 25 Nov 05:08 2014
Picon

xmerl_xsd validation failed on attribute list's type

Hello,

on Erlang R16B03, R17.0 I've found that xmerl_xsd doesn't validate xml, that contains list's type element attribute. Validation failed with error:
{error,
    [{[],xmerl_xsd,
      {could_not_check_value_for_type,
          {list,[{simpleType,{item,[],[]}}]}}}]}

Steps to reproduce:
1. Untar archive in one directory.
2. compile xsd_list_attr_test.erl
3. xsd_list_attr_test:test().
4. look at erlang console. There will be printed:
Validation result: {error,
                       [{[],xmerl_xsd,
                         {could_not_check_value_for_type,
                             {list,[{simpleType,{item,[],[]}}]}}}]}

_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Nicolas Dudebout | 23 Nov 12:56 2014
Picon

Dialyzer does not check record update types

Dialyzer checks the type of record elements when creating them but not when updating them. Pasted below is a minimal working example.

Nicolas




-module(test).

-export([ baz/1, quux/2 ]).

-type bar()    :: atom().
-type notbar() :: string().

-record(foo, { bar :: bar() }).


% CORRECT: Dialyzer generates a warning
% test.erl:13: Invalid type specification for function test:baz/1. The success typing is (atom()) -> #foo{bar::atom()}
-spec baz(notbar()) -> #foo{}.

baz(NotBar) ->
  #foo{ bar = NotBar }.

% INCORECT: Dialyzer does not say anything
-spec quux(#foo{}, notbar()) -> #foo{}.

quux(Foo, NotBar) ->
  Foo#foo{ bar = NotBar }.
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Nicolas Dudebout | 23 Nov 12:53 2014
Picon

Dialyzer re-factoring in maint fixes a bug and should make it to maint-17

The "minor re-factoring" mentioned in https://github.com/erlang/otp/commit/197a8467f465930372f31c8f8b7340f8339aa23a actually fixes a bug.

cleanup_compile_options/1 is supposed to filter out elements from a list. However, the original implementation does not recurse properly and filters out at most one option. The re-factored implementation does not have this problem.

This bug is preventing me from creating a PLT file for some libraries compiled with r16b03 by using the dialyzer included with 17.3. Applying this patch solves the problem.

I think that this patch should be applied to maint-17.

Nicolas
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Mikael Pettersson | 20 Nov 12:49 2014
Picon

bogus 'unsafe variable' warning with try-else

The following, adapted from an example in the online Erlang
Reference Manual, looks like a bug to me:

> cat bug.erl
-module(bug).
-compile(export_all).

termize_file(Name) ->
  {ok,F} = file:open(Name, [read,binary]),
  try
    {ok,Bin} = file:read(F, 1024*1024)
  after
    file:close(F)
  end,
  binary_to_term(Bin).
> erlc bug.erl
bug.erl:11: variable 'Bin' unsafe in 'try' (line 6)

Unless I'm missing something, there is no way to reach the
binary_to_term/1 call without successfully evaluating the
{ok,Bin} = ... match expression; therefore the use is not
unsafe.  If the file:read/2 call or the {ok,Bin} match fails,
the after clause runs and the entire try expression fails,
and the binary_to_term/1 is not reached.

Reproduced with 17.3 and r15b03-1.

Workaround: match on the value of the try itself:
"{ok,Bin} = try file:read(...) after ... end".

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

Andy Till | 19 Nov 23:11 2014
Picon

erts_use_sender_punish not always a good thing

Short outline of how erts_use_sender_punish works, please comment if 
there are any errors in the description.

erts_use_sender_punish is a flag hard coded to 1 (true), when it is true 
a process sending messages to another process will have its reduction 
count reduced by the number of messages in the receivers message queue 
multiplied by four.  Sending messages to processes with zero messages in 
the queue is free in terms of reductions, but sending messages to load 
queues is very expensive and will lead the scheduler to context switch 
to another process more often.

In the case where the the relationship between of producers and 
consumers is one to one, this makes sense.  It provides back pressure 
when part of the system is loaded.

In the case where there is one producer to many consumers, if one 
consumer gets a flood of messages and the producer is punished then the 
punishment is not only on the producer but on all other consumers 
because the producer cannot create enough work for them as it used all 
of its reductions.

This makes performance unpredictable when work cannot be spread
evenly.

Cheers

Andy

Code:

https://github.com/erlang/otp/blob/a70f0ce9b34e4db61dacb8db24f9ab5671ed4c8a/erts/emulator/beam/erl_init.c#L694

https://github.com/erlang/otp/blob/682a6082159568f40615f03d12d44ee70edd14c6/erts/emulator/beam/bif.c#L2058

https://github.com/erlang/otp/blob/a8e12f7168c14cc765a63a51c838d065412795d7/erts/emulator/beam/erl_message.c#L504 

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

Wiesław Bieniek | 17 Nov 11:22 2014
Picon

Problem with timeout on ldaps connection.

Hello,

I'm using ldaps protocol to communicate with LDAP Server

Handle = case eldap:open([LDAPHost], [{port, LDAPPort}, {timeout, Timeout}, {log, LogFun}, {ssl, true}, {sslopts, [{verify, verify_peer}, {reuse_sessions, false}, {cacertfile, CertFile}]}]) of
                 {ok, H} -> H;
                 Error -> ?DEBUG("Open Error: [~p]~n", [Error]),
                          error(Error)
             end,

When LDAP on LDAPHost:LDAPPort is not working and cannot respond for request this function hangs for about 3 minutes (although the Timeout is set to 1000 (1 sec.)) and then returns with {error, etimedout}.

I made some investigations and the root cause of this seems to be function from eldap:

do_connect(Host, Data, Opts) when Data#eldap.ldaps == false ->
    gen_tcp:connect(Host, Data#eldap.port, Opts, Data#eldap.timeout);
do_connect(Host, Data, Opts) when Data#eldap.ldaps == true ->
    ssl:connect(Host, Data#eldap.port, Opts++Data#eldap.tls_opts).

It does not use timeout when connecting using SSL.

I guess It need fixing is next release.

But there is an additional question:

Due to agreement with user we cannot change any part of OTP Distributions. Only official releases of OTP can be used.
Is it possible to workaround the problem without updating eldap.erl and recompiling OTP ?

--
Wiesław Bieniek
Projektant Telco BSS R&D

tel. +48 12 646 12 66
website: www.comarch.pl
Attachment (smime.p7s): application/pkcs7-signature, 2972 bytes
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Dariusz Gadomski | 14 Nov 11:01 2014

Cannot bind epmd to an IPv4 address after building with -DEPMD6

Hello everyone,

There are users observing problems with binding to an IPv4 address with
erlang 16b3 version built with -DEPMD6 flag [1]. This flag has been added
as a response to another bug [2].

By looking at erts/epmd/src/epmd_int.h I see that the address definitions are
mutually exclusive - enabling IPv6 makes all addresses IPv6-only which may
result in problems with binding to a specific IPv4 address:
$ ERL_EPMD_ADDRESS="127.0.0.1" epmd
epmd: Fri Nov 14 11:00:47 2014: cannot parse IP address "127.0.0.1"

Can you please confirm this? Is it a known issue? Maybe there is a workaround?

[1] https://bugs.launchpad.net/ubuntu/+source/erlang/+bug/1374109
[2] https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/1312507

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

Davery | 11 Nov 23:59 2014
Picon

bug ?

hi there:

Winxp sp3
Erlang 17.3

-- 
have a good day.

Regards,
Davery
Erlang/OTP 17 [erts-6.2] [async-threads:10]

原工作目录:"d:/erl6.2/usr"
当前工作目录:"d:/work"
Eshell V6.2  (abort with ^G)
1> hello : start().
Hello world
ok
2> my_module : pie().
3.14
3> my_module : print(). 
** exception error: undefined function my_module:print/0
4> my_module : print(223444).
The value of Term is: 223444.
ok
5> my_module : print(22344hello).
* 1: syntax error before: hello
5> my_module : print(hello).     
The value of Term is: hello.
ok
6> my_module : print(22344hello).
* 1: syntax error before: hello
6> my_module : print(32#hello).  
The value of Term is: 18306744.
ok
7> my_module : print(22344+hello).
** exception error: an error occurred when evaluating an arithmetic expression
     in operator  +/2
        called as 22344 + hello
8> my_module : print("22344"+hello).
** exception error: an error occurred when evaluating an arithmetic expression
     in operator  +/2
        called as "22344" + hello
9> my_module : print("22344"hello). 
* 1: syntax error before: hello
9> my_module : print(hello 122421 23412  412).
* 1: syntax error before: 122421
9> my_module : print("hello 122421 23412  412").
The value of Term is: [104,101,108,108,111,32,49,50,50,52,50,49,32,50,51,52,49,50,32,32,52,49,50].
ok
10> my_module : print($"hello 122421 23412  412").
10> my_module : print($hello 122421 23412  412).  
10> .
10> my_module : print(32#hello).                  
10> 
10> 
10> 
User switch command
 --> j
   1* {shell,start,[init]}
 --> 1
Unknown command
 --> c
1
10> my_module : print(hello).                     
10> q().
10> 
User switch command
 --> j
   1* {shell,start,[init]}
 --> k 1
 --> j
 --> s
 --> j
   2* {shell,start,[]}
Erlang/OTP 17 [erts-6.2] [async-threads:10]

原工作目录:"d:/erl6.2/usr"
当前工作目录:"d:/work"
Eshell V6.2  (abort with ^G)
1> hello : start().
Hello world
ok
2> my_module : pie().
3.14
3> my_module : print(). 
** exception error: undefined function my_module:print/0
4> my_module : print(223444).
The value of Term is: 223444.
ok
5> my_module : print(22344hello).
* 1: syntax error before: hello
5> my_module : print(hello).     
The value of Term is: hello.
ok
6> my_module : print(22344hello).
* 1: syntax error before: hello
6> my_module : print(32#hello).  
The value of Term is: 18306744.
ok
7> my_module : print(22344+hello).
** exception error: an error occurred when evaluating an arithmetic expression
     in operator  +/2
        called as 22344 + hello
8> my_module : print("22344"+hello).
** exception error: an error occurred when evaluating an arithmetic expression
     in operator  +/2
        called as "22344" + hello
9> my_module : print("22344"hello). 
* 1: syntax error before: hello
9> my_module : print(hello 122421 23412  412).
* 1: syntax error before: 122421
9> my_module : print("hello 122421 23412  412").
The value of Term is: [104,101,108,108,111,32,49,50,50,52,50,49,32,50,51,52,49,50,32,32,52,49,50].
ok
10> my_module : print($"hello 122421 23412  412").
10> my_module : print($hello 122421 23412  412).  
10> .
10> my_module : print(32#hello).                  
10> 
10> 
10> 
User switch command
 --> j
   1* {shell,start,[init]}
 --> 1
Unknown command
 --> c
1
10> my_module : print(hello).                     
10> 
10> 
10> 
10> 
10> 
10> 
10> 
10> 
10> 
10> 
10> 
10> q().
10> 
10> 
10> 
10> 
10> 
10> 
10> 
User switch command
 --> j
   1* {shell,start,[init]}
 --> k 1
 --> j
 --> s
 --> j
   2* {shell,start,[]}
 --> c
Eshell V6.2  (abort with ^G)
1> my_module : print("sdfasf1243213412").
The value of Term is: [115,100,102,97,115,102,49,50,52,51,50,49,51,52,49,50].
ok
2> my_module : print($sdfasf1243213412). 
* 1: syntax error before: dfasf1243213412
2> my_module : print("sdfasf1243213412").
The value of Term is: [115,100,102,97,115,102,49,50,52,51,50,49,51,52,49,50].
ok
3> my_module : print(sdfasf1243213412).  
The value of Term is: sdfasf1243213412.
ok
4> my_module : print(11sdfasf1243213412).
* 1: syntax error before: sdfasf1243213412
4> my_module : print([11sd,fasf1243213412]).
* 1: syntax error before: sd
4> my_module : print(["11sd",fasf1243213412]).
The value of Term is: [[49,49,115,100],fasf1243213412].
ok
5> my_module : print($"["11sd",fasf1243213412]").
5> 
5> 
5> 
5> 
User switch command
 --> s
 --> j
   2  {shell,start,[]}
   3* {shell,start,[]}
 --> k 2
 --> j
   3* {shell,start,[]}
 --> c 3
Eshell V6.2  (abort with ^G)
1> c = '$"srdgegr134'
1> .
** exception error: no match of right hand side value '$"srdgegr134'
2> c = ['$"srdgegr134].
2> 
2> 
2> 
2> 
2> c.
2> 
2> 
2> j
2> 
User switch command
 --> j
   3* {shell,start,[]}
 --> 
 --> 
 --> 
 --> 
 --> 
 --> 
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
Eric Meadows-Jönsson | 12 Nov 01:02 2014
Picon

httpc: Duplicate requests sent on long-running request sending

Duplicate requests will be sent when you have already run a request against the same host and therefor have an existing keep-alive connection open. If you then perform a request where the request body takes more than five seconds to send a second identical request will be sent concurrently.

I think I have figured what is happening after tracing httpc.

The code reaches https://github.com/erlang/otp/blob/ec8e9a96bd0d0148df5008b0665da0725e5b3f92/lib/inets/src/http_client/httpc_manager.erl#L851 and calls `httpc_handler:send` which blocks while sending the request. If the request body takes longer than five seconds to send the `gen_server:call` will timeout and reach this code https://github.com/erlang/otp/blob/ec8e9a96bd0d0148df5008b0665da0725e5b3f92/lib/inets/src/http_client/httpc_manager.erl#L856. `start_handler` will create a new connection sending another identical request even though a request is already in progress.

I would be happy to provide a patch after some guidance on what the fix should be. Maybe the `handle_call` in `httpc_handler` should return immediately and the request be sent without blocking the caller?

--
Eric Meadows-Jönsson
_______________________________________________
erlang-bugs mailing list
erlang-bugs <at> erlang.org
http://erlang.org/mailman/listinfo/erlang-bugs
PAILLEAU Eric | 11 Nov 23:40 2014
Picon

Missing return values for mnesia:subscribe/1 in documentation

Hi,
I found that in online documentation is missing possible returned values 
of mnesia:subscribe/1 .

By trying, looks like {ok, nodes()} when OK, but what on error ?

I cannot see more info in User's Guide either ...

---8<------------------------------------------------------------------------------
subscribe(EventCategory)

Ensures that a copy of all events of type EventCategory are sent to the 
caller. The event types available are described in the Mnesia User's Guide.
---8<------------------------------------------------------------------------------

Regards.

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


Gmane