從erlang otp21 升級 otp23 遇到的坑

概述

最近將erlang從otp21.3.8.17升級至最新的otp23.1. 遇到了兩個編譯不告警, 但版本先後語義不一致, 且在changelist中未說起的問題. 在此作個記錄.html

問題

httpc ssl options verify: 0 致使failed_connect

現象

Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.10.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :httpc.request(:get, {'https://www.baidu.com/', []}, [ssl: [verify: 0]], [])
{:error,
 {:failed_connect,
  [
    {:to_address, {'www.baidu.com', 443}},
    {:inet, [:inet], {:options, {:verify, 0}}}
  ]}}

定位

發現錯誤是ssl拋出的.node

Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.10.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :ssl.handle_options([verify: 0], :client)                             
** (throw) {:error, {:options, {:verify, 0}}}
    (ssl 10.1) ssl.erl:2738: :ssl.handle_verify_option/2
    (ssl 10.1) ssl.erl:1644: :ssl.process_options/3
    (ssl 10.1) ssl.erl:1598: :ssl.handle_options/3

ssl-9.2.3.5 無問題.app

Erlang/OTP 21 [erts-10.3.5.13] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :ssl.handle_options([verify: 0], :client) 
{:ok,
 {:config,

ssl-10.1的release node中未提到廢棄verify: 0的使用async

crypt.stream_init從值語義變爲了引用語義

現象

Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.10.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :crypto.stream_init(:rc4, "a")
{:rc4, {#Reference<0.1758837082.2328756225.106374>, :flg_undefined}}
Erlang/OTP 21 [erts-10.3.5.13] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :crypto.stream_init(:rc4, "a")
{:rc4,
 <<0, 0, 0, 0, 0, 0, 0, 0, 170, 0, 0, 0, 17, 0, 0, 0, 79, 0, 0, 0, 138, 0, 0, 0,
   225, 0, 0, 0, 85, 0, 0, 0, 57, 0, 0, 0, 113, 0, 0, 0, 223, 0, 0, 0, 54, 0, 0,
   0, ...>>}

一樣沒法在crypto-4.8的release-note中找到code

相關文章
相關標籤/搜索