<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p style="color: #777777;">
<a href="https://gitlab.com/IBBoard">IBBoard</a>
commented:
</p>
<div style="">
<p dir="auto">Okay, I've got a "minimal" Vala and <a href="https://github.com/GNOME/librest" rel="nofollow noreferrer noopener" target="_blank">librest</a> case (plus the necessary vapi files) that will intermittently error. No Twitter credentials required (because it's an SSL error and so we don't have to have a valid user)</p>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">async void ssl_test () {</span>
<span id="LC2" class="line" lang="plaintext">    for (int i = 0; i < 60; i++) {</span>
<span id="LC3" class="line" lang="plaintext">        var proxy = new Rest.OAuthProxy ("a",</span>
<span id="LC4" class="line" lang="plaintext">                                         "b",</span>
<span id="LC5" class="line" lang="plaintext">                                         "https://api.twitter.com/",</span>
<span id="LC6" class="line" lang="plaintext">                                         false);</span>
<span id="LC7" class="line" lang="plaintext">        var call = proxy.new_call ();</span>
<span id="LC8" class="line" lang="plaintext">        call.set_method ("GET");</span>
<span id="LC9" class="line" lang="plaintext">        call.set_function ("1.1/statuses/home_timeline.json");</span>
<span id="LC10" class="line" lang="plaintext">        call.add_param ("since_id", "1173176929995907072");</span>
<span id="LC11" class="line" lang="plaintext">        call.add_param ("count", "200");</span>
<span id="LC12" class="line" lang="plaintext">        call.add_param ("contributor_details", "true");</span>
<span id="LC13" class="line" lang="plaintext">        call.add_param ("tweet_mode", "extended");</span>
<span id="LC14" class="line" lang="plaintext">        call.add_param ("include_my_retweet", "true");</span>
<span id="LC15" class="line" lang="plaintext">        call.invoke_async.begin (null, (obj, res) => {</span>
<span id="LC16" class="line" lang="plaintext">            try {</span>
<span id="LC17" class="line" lang="plaintext">                call.invoke_async.end (res);</span>
<span id="LC18" class="line" lang="plaintext">            } catch (GLib.Error e) {</span>
<span id="LC19" class="line" lang="plaintext">            if (e.code < 400)</span>
<span id="LC20" class="line" lang="plaintext">                warning(e.message);</span>
<span id="LC21" class="line" lang="plaintext">            }</span>
<span id="LC22" class="line" lang="plaintext">            ssl_test.callback();</span>
<span id="LC23" class="line" lang="plaintext">        });</span>
<span id="LC24" class="line" lang="plaintext">        yield;</span>
<span id="LC25" class="line" lang="plaintext">        GLib.Thread.usleep(1000000 * 2);</span>
<span id="LC26" class="line" lang="plaintext">    }</span>
<span id="LC27" class="line" lang="plaintext">}</span>
<span id="LC28" class="line" lang="plaintext"></span>
<span id="LC29" class="line" lang="plaintext"></span>
<span id="LC30" class="line" lang="plaintext">int main (string[] args) {</span>
<span id="LC31" class="line" lang="plaintext">    var loop = new MainLoop();</span>
<span id="LC32" class="line" lang="plaintext">    ssl_test.begin ((obj, res) => {</span>
<span id="LC33" class="line" lang="plaintext">        loop.quit();</span>
<span id="LC34" class="line" lang="plaintext">    });</span>
<span id="LC35" class="line" lang="plaintext">    loop.run();</span>
<span id="LC36" class="line" lang="plaintext">    return 0;</span>
<span id="LC37" class="line" lang="plaintext">}</span></code></pre>
<p dir="auto">I saw about 15 out of the 60 requests return <code>Error performing TLS handshake: An unexpected TLS packet was received</code> when I just ran it.</p>
<p dir="auto">I'll try to strip it down from there on another night. I had to put the proxy creation in the loop so that it didn't keep re-using the connection. I suspect other background tasks are consuming the connection pool in the app, which is why I saw different behaviour when reusing the proxy (as the app does).</p>
</div>


</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/issues/841#note_224130264">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/sent_notifications/64e62b62a16b52075e54c8ebd449b608/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/issues/841#note_224130264"}}</script>


</p>
</div>
</body>
</html>