顯示具有 network 標籤的文章。 顯示所有文章
顯示具有 network 標籤的文章。 顯示所有文章

2019年1月31日 星期四

iOS 開發筆記 - [BoringSSL] nw_protocol_boringssl_input_finished, boringssl_context_alert_callback_handler, boringssl_session_errorlog, boringssl_session_handshake_error_print 處理方式

CFNETWORK_DIAGNOSTICS=3

看到以下訊息,完全摸不著頭緒:

[BoringSSL] nw_protocol_boringssl_input_finished(1543) [C294.1:2][0x11f2823d0] Peer disconnected during the middle of a handshake. Sending errSSLClosedNoNotify(-9816) alert
TIC TCP Conn Failed [294:0x2812a5a40]: 3:-9816 Err(-9816)
[BoringSSL] nw_protocol_boringssl_input_finished(1543) [C295.1:2][0x108589540] Peer disconnected during the middle of a handshake. Sending errSSLClosedNoNotify(-9816) alert
TIC TCP Conn Failed [295:0x2812d0540]: 3:-9816 Err(-9816)
[BoringSSL] boringssl_context_alert_callback_handler(3724) [C296.1:2][0x108450060] Alert level: fatal, description: inappropriate fallback
[BoringSSL] boringssl_session_errorlog(224) [C296.1:2][0x108450060] [boringssl_session_handshake_incomplete] SSL_ERROR_SSL(1): operation failed within the library
[BoringSSL] boringssl_session_handshake_error_print(205) [C296.1:2][0x108450060] 4838922792:error:1000043e:SSL routines:OPENSSL_internal:TLSV1_ALERT_INAPPROPRIATE_FALLBACK:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-109.230.1/ssl/tls_record.cc:586:SSL alert number 86
[BoringSSL] boringssl_context_get_error_code(3617) [C296.1:2][0x108450060] SSL_AD_INAPPROPRIATE_FALLBACK
TIC TCP Conn Failed [296:0x2812d0a80]: 3:-9860 Err(-9860)
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9860)
Task <FAB06FFC-73C2-48D8-AAEA-750F2FCF1969>.<0> HTTP load failed (error code: -1200 [3:-9860])
NSURLConnection finished with error - code -1200


最後拜讀 StackOverflow - XCode 9 iOS 11 BoringSSL SSL_ERROR_ZERO_RETURN 可以定義 CFNETWORK_DIAGNOSTICS = 3 數值來 debug,並透過 Xcode's scheme 管理環境變數即可,收工!

2014年8月21日 星期四

[Linux] 使用常見的指令進行系統監控 @ Ubuntu 14.04

取得 Server 代號 - 使用 hostname 指令:

$ hostname

取得 Server OS 資訊 - 使用 lsb_release 指令:

$ lsb_release -a

取得 CPU 使用率 - 使用 vmstat、tail 和 awk 指令:

$ echo $((100-$(vmstat|tail -1|awk '{print $15}')))

取得 System Loading 資訊 - 使用 uptime 和 awk 指令:

$ uptime | egrep -o 'load average[s]*: [0-9,\. ]+' | awk -F',' '{print $1$2$3}' | awk -F' ' '{print $3}'
$ uptime | egrep -o 'load average[s]*: [0-9,\. ]+' | awk -F',' '{print $1$2$3}' | awk -F' ' '{print $4}'
$ uptime | egrep -o 'load average[s]*: [0-9,\. ]+' | awk -F',' '{print $1$2$3}' | awk -F' ' '{print $5}'


取得 Apache Web Server Processes 資訊 - 使用 pgrep 跟 wc 指令:

$ pgrep apache2 | wc -l

取得 Memory 使用率 - 使用 free、grep 跟 awk 指令:

$ free -m | grep Mem | awk '{print $3/$2 * 100}'

取得 Network 即時流量 - 使用 nicstat、grep 跟 awk,假定網路卡是 eth 開頭:

In:
$ nicstat | grep eth |  awk '{print $3}'

Out:
$ nicstat | grep eth |  awk '{print $4}'


最後,檢查上述指令是否都存在:

#!/bin/sh
CMD_USAGE=$(echo 'hostname curl pgrep wc awk tail uptime vmstat free nicstat' | tr ";" "\n")
for cmd in $CMD_USAGE
do
        path=`which $cmd`
        if [ -z $path ] || [ ! -x $path ] ; then
                echo "$cmd not found"
                exit
        fi
done


其他資源: