Golang卡在WaitGroup中。

huangapple go评论73阅读模式
英文:

Golang stuck in WaitGroup

问题

我被卡在一个自己的等待循环中,不太确定原因。该函数接收一个输入通道和一个输出通道,然后对通道中的每个项目执行http.GET请求以获取内容,并从HTML中提取标签。</p> <p>获取和解析的过程在一个go协程中进行,并且我设置了一个等待组(innerWait),以确保在关闭输出通道之前我已经处理完所有内容。</p> <p>日志内容如下:</p> <p>2015/08/09 22:02:10 INFO: Revived query parameter: golang<br /> 2015/08/09 22:02:10 INFO: Getting active tweets from the last 7 days.<br /> 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup.<br /> 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup.<br /> 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup.<br /> 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup.<br /> 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup.<br /> 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup.<br /> 2015/08/09 22:02:10 INFO: Waiting for title pull wait group.<br /> 2015/08/09 22:02:10 INFO: Getting title for: <a href="http://devsisters.github.io/goquic/" rel="external nofollow" target="_blank">http://devsisters.github.io/goquic/</a><br /> 2015/08/09 22:02:10 INFO: Pulled title: GoQuic by devsisters<br /> 2015/08/09 22:02:10 INFO: Getting title for: <a href="http://whizdumb.me/2015/03/03/matching-a-string-and-extracting-values-using-regex/" rel="external nofollow" target="_blank">http://whizdumb.me/2015/03/03/matching-a-string-and-extracting-values-using-regex/</a><br /> 2015/08/09 22:02:10 INFO: Pulled title: Matching a string and extracting values using regex | Whizdumb's blog<br /> 2015/08/09 22:02:10 INFO: Getting title for: <a href="https://www.reddit.com/r/golang/comments/3g7tyv/dropboxs_infrastructure_is_go_at_a_huge_scale/" rel="external nofollow" target="_blank">https://www.reddit.com/r/golang/comments/3g7tyv/dropboxs_infrastructure_is_go_at_a_huge_scale/</a><br /> 2015/08/09 22:02:10 INFO: Pulled title: Dropbox's infrastructure is Go at a huge scale : golang<br /> 2015/08/09 22:02:10 INFO: Getting title for: <a href="http://dave.cheney.net/2015/08/08/performance-without-the-event-loop" rel="external nofollow" target="_blank">http://dave.cheney.net/2015/08/08/performance-without-the-event-loop</a><br /> 2015/08/09 22:02:10 INFO: Pulled title: Performance without the event loop | Dave Cheney<br /> 2015/08/09 22:02:11 INFO: Getting title for: <a href="https://github.com/ccirello/sublime-gosnippets" rel="external nofollow" target="_blank">https://github.com/ccirello/sublime-gosnippets</a><br /> 2015/08/09 22:02:11 INFO: Pulled title: ccirello/sublime-gosnippets · GitHub<br /> 2015/08/09 22:02:11 INFO: Getting title for: <a href="https://medium.com/iron-io-blog/an-easier-way-to-create-tiny-golang-docker-images-7ba2893b160?mkt_tok=3RkMMJWWfF9wsRonuqTMZKXonjHpfsX57ewoWaexlMI/0ER3fOvrPUfGjI4ATsNrI%2BSLDwEYGJlv6SgFQ7LMMaZq1rgMXBk%3D&utm_content=buffer45a1c&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer" rel="external nofollow" target="_blank">https://medium.com/iron-io-blog/an-easier-way-to-create-tiny-golang-docker-images-7ba2893b160?mkt_tok=3RkMMJWWfF9wsRonuqTMZKXonjHpfsX57ewoWaexlMI/0ER3fOvrPUfGjI4ATsNrI%2BSLDwEYGJlv6SgFQ7LMMaZq1rgMXBk%3D&utm_content=buffer45a1c&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer</a><br /> 2015/08/09 22:02:11 INFO: Pulled title: An Easier Way to Create Tiny Golang Docker Images — Iron.io Blog — Medium</p> <p>根据日志,我可以看到我已经到达了innerWait.Wait()命令,这也告诉我管道的另一端已经关闭了入站通道。</p> <p>似乎匿名函数中的延迟语句没有被调用,因为我无法在任何地方看到延迟的日志语句。但是我无法弄清楚原因,因为该块中的所有代码似乎都执行了。</p> <p>希望能得到帮助。</p> <details> <summary>英文:</summary> <p>I'm stuck in my own wait loop and not really sure why. The function takes an input and output channel, then takes each item in the channel, executes an http.GET for the content and pulls the <title> tag from the html.</p> <p>The process to GET and scrape is inside a go routine, and I've set up a wait group (innerWait) to be sure that I've processed everything before closing the output channel.</p> <pre><code> func (fp FeedProducer) getTitles(in &lt;-chan feeds.Item, out chan&lt;- feeds.Item, wg *sync.WaitGroup) { defer wg.Done() var innerWait sync.WaitGroup for item := range in { log.Infof(fp.c, &quot;Incrementing inner WaitGroup.&quot;) innerWait.Add(1) go func(item feeds.Item) { defer innerWait.Done() defer log.Infof(fp.c, &quot;Decriment inner wait group by defer.&quot;) client := urlfetch.Client(fp.c) resp, err := client.Get(item.Link.Href) log.Infof(fp.c, &quot;Getting title for: %v&quot;, item.Link.Href) if err != nil { log.Errorf(fp.c, &quot;Error retriving page. %v&quot;, err.Error()) return } if strings.ToLower(resp.Header.Get(&quot;Content-Type&quot;)) == &quot;text/html; charset=utf-8&quot; { title := fp.scrapeTitle(resp) item.Title = title } else { log.Errorf(fp.c, &quot;Wrong content type. Received: %v from %v&quot;, resp.Header.Get(&quot;Content-Type&quot;), item.Link.Href) } out &lt;- item }(item) } log.Infof(fp.c, &quot;Waiting for title pull wait group.&quot;) innerWait.Wait() log.Infof(fp.c, &quot;Done waiting for title pull.&quot;) close(out) } func (fp FeedProducer) scrapeTitle(request *http.Response) string { defer request.Body.Close() tokenizer := html.NewTokenizer(request.Body) var titleIsNext bool for { token := tokenizer.Next() switch { case token == html.ErrorToken: log.Infof(fp.c, &quot;Hit the end of the doc without finding title.&quot;) return &quot;&quot; case token == html.StartTagToken: tag := tokenizer.Token() isTitle := tag.Data == &quot;title&quot; if isTitle { titleIsNext = true } case titleIsNext &amp;&amp; token == html.TextToken: title := tokenizer.Token().Data log.Infof(fp.c, &quot;Pulled title: %v&quot;, title) return title } } } </code></pre> <p>Log content looks like this:</p> <pre><code>2015/08/09 22:02:10 INFO: Revived query parameter: golang 2015/08/09 22:02:10 INFO: Getting active tweets from the last 7 days. 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup. 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup. 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup. 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup. 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup. 2015/08/09 22:02:10 INFO: Incrementing inner WaitGroup. 2015/08/09 22:02:10 INFO: Waiting for title pull wait group. 2015/08/09 22:02:10 INFO: Getting title for: http://devsisters.github.io/goquic/ 2015/08/09 22:02:10 INFO: Pulled title: GoQuic by devsisters 2015/08/09 22:02:10 INFO: Getting title for: http://whizdumb.me/2015/03/03/matching-a-string-and-extracting-values-using-regex/ 2015/08/09 22:02:10 INFO: Pulled title: Matching a string and extracting values using regex | Whizdumb&#39;s blog 2015/08/09 22:02:10 INFO: Getting title for: https://www.reddit.com/r/golang/comments/3g7tyv/dropboxs_infrastructure_is_go_at_a_huge_scale/ 2015/08/09 22:02:10 INFO: Pulled title: Dropbox&#39;s infrastructure is Go at a huge scale : golang 2015/08/09 22:02:10 INFO: Getting title for: http://dave.cheney.net/2015/08/08/performance-without-the-event-loop 2015/08/09 22:02:10 INFO: Pulled title: Performance without the event loop | Dave Cheney 2015/08/09 22:02:11 INFO: Getting title for: https://github.com/ccirello/sublime-gosnippets 2015/08/09 22:02:11 INFO: Pulled title: ccirello/sublime-gosnippets &#183; GitHub 2015/08/09 22:02:11 INFO: Getting title for: https://medium.com/iron-io-blog/an-easier-way-to-create-tiny-golang-docker-images-7ba2893b160?mkt_tok=3RkMMJWWfF9wsRonuqTMZKXonjHpfsX57ewoWaexlMI/0ER3fOvrPUfGjI4ATsNrI%2BSLDwEYGJlv6SgFQ7LMMaZq1rgMXBk%3D&amp;utm_content=buffer45a1c&amp;utm_medium=social&amp;utm_source=twitter.com&amp;utm_campaign=buffer 2015/08/09 22:02:11 INFO: Pulled title: An Easier Way to Create Tiny Golang Docker Images — Iron.io Blog — Medium </code></pre> <p>I can see that I'm getting to the innerWait.Wait() command based on the logs, which also tells me that the inbound channel has been closed on the other side of the pipe.</p> <p>It would appear that the defer statements in the anonymous function are not being called, as I can't see the deferred log statement printed anywhere. But I can't for the life of me tell why as all code in that block appears to execute.</p> <p>Help is appreciated.</p> </details> <h1 id="1">答案1</h1> <p><strong>得分</strong>: 7</p> <p>以下是要翻译的内容:</p> <p>goroutine在这一行代码中被卡住了,它们正在向<code>out</code>发送数据:</p> <pre><code> out <- item </code></pre> <p>修复的方法是启动一个goroutine来接收<code>out</code>的数据。</p> <p>解决这类问题的一个好方法是通过发送SIGQUIT信号来转储goroutine的堆栈信息。</p> <details> <summary>英文:</summary> <p>The goroutines are stuck sending to <code>out</code> at this line:</p> <pre><code> out &lt;- item </code></pre> <p>The fix is to start a goroutine to receive on <code>out</code>.</p> <p>A good way to debug issues like this is to dump the goroutine stacks by sending the process a SIGQUIT.</p> </details> </p> </div> <div class="copyright-post betip" > <div class="be-nav-l"> <div class="be-nav-logo"> <div class="logo-site"> <div class="site-name-main"> <p class="site-description">通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。</p> </div> </div> </div> </div> </div> <div class="clear"></div> <div class="turn-small"></div> <div class="sharing-box betip" data-aos="zoom-in"> <a class="be-btn-beshare be-btn-donate use-beshare-donate-btn" rel="external nofollow" data-hover="打赏"><div class="arrow-share"></div></a> <a class="be-btn-beshare be-btn-like use-beshare-like-btn" data-count="0" rel="external nofollow"> <span class="sharetip bz like-number"> 点赞 </span> <div class="triangle-down"></div> </a> <a class="be-btn-beshare be-btn-share use-beshare-social-btn" rel="external nofollow" data-hover="分享"><div class="arrow-share"></div></a> <span class="post-link">https://go.coder-hub.com/31909291.html</span> <a class="tooltip be-btn-beshare be-btn-link be-btn-link-b use-beshare-link-btn" rel="external nofollow" onclick="myFunction()" onmouseout="outFunc()"><span class="sharetip bz copytip">复制链接</span></a> <a class="tooltip be-btn-beshare be-btn-link be-btn-link-l use-beshare-link-btn" rel="external nofollow" onclick="myFunction()" onmouseout="outFunc()"><span class="sharetip bz copytipl">复制链接</span></a> <a class="be-btn-beshare be-share-poster use-beshare-poster-btn" rel="external nofollow" data-hover="海报"><div class="arrow-share"></div></a> </div> <div class="content-empty"></div> <footer class="single-footer"> <div class="single-cat-tag dah"><div class="single-cat dah"><i class="be be-sort"></i><a href="https://go.coder-hub.com/category/go" rel="category tag">go</a></div></div> </footer> <div class="clear"></div> </div> </article> <div class="authorbio ms load betip" data-aos=fade-up> <img class="avatar photo" src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=" alt="huangapple" width="96" height="96" data-original="https://go.coder-hub.com/wp-content/uploads/2023/08/1_avatar-96x96.png" /> <ul class="spostinfo"> <li>本文由 <strong><a href="https://go.coder-hub.com/author/huangapple" title="文章作者 huangapple" rel="author">huangapple</a></strong> 发表于 2015年8月10日 06:06:28</li> <li class="reprinted"><strong>转载请务必保留本文链接:</strong>https://go.coder-hub.com/31909291.html</li> </ul> <div class="clear"></div> </div> <div class="single-code-tag betip"> <div class='clear'></div> <div class="apc-ajax-post-item-wrap ajax-cat-post-wrap" data-more="more" data-apc-ajax-post-item='{"show_filter":"yes","btn":"yes","btn_all":"no","initial":"-1","layout":"1","post_type":"post","posts_per_page":"4","cat":"5536,1382","terms":"","paginate":"no","hide_empty":"true","orderby":"rand","order":"DESC","meta_key":"","more":"more","mid":"","style":"photo","listimg":"","column":"4","infinite":"","animation":"","item_id":"","slider":"","tags":"tag","special":"","prev_next":"true","img":"","sticky":"","children":"true"}'> <div class="acx-filter-div" data-layout="1"> <ul> <li class="bea-texonomy ms apc-cat-btu" data_id="5536" data-aos=fade-up>go</li> <li class="bea-texonomy ms apc-cat-btu" data_id="1382" data-aos=fade-up>google-app-engine</li> </ul> </div> <div class="acx-ajax-container"> <div class="acx-loader"> <div class="dual-ring"></div> </div> <div class="beall-filter-result"> <div class="apc-postitem-wrapper"> <section class="picture-area content-area grid-cat-4"> <div class="apc-post-item apc_layout_1 "> <article id="post-75476" class="post-item-list post picture scl" data-aos="zoom-in" > <div class="picture-box sup"> <figure class="picture-img gdz"> <div class="thumbs-b lazy"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/31581434.html" data-src="https://cdn.coder-hub.com/wp/img/25.jpg"></a></div> </figure> <h2 class="grid-title gdz"><a href="https://go.coder-hub.com/31581434.html" rel="bookmark">如何在Go中获取socket.io握手查询</a></h2> <span class="grid-inf gdz"> <span class="grid-author"><a href="https://go.coder-hub.com/author/huangapple" rel="author"> <span class="meta-author grid-meta-author"> <span class="meta-author-avatar load"> <img class="avatar photo" src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=" alt="huangapple" width="96" height="96" data-original="https://go.coder-hub.com/wp-content/uploads/2023/08/1_avatar-96x96.png" /> </span> </span> </a> </span> <span class="g-cat"><a href="https://go.coder-hub.com/category/go">go</a></span> <span class="grid-inf-l"> <span class="views"><i class="be be-eye ri"></i>82</span> <span class="date"><time datetime="2015-07-23 16:00:49">07/23</time></span> </span> </span> <div class="clear"></div> </div> </article> <article id="post-82308" class="post-item-list post picture scl" data-aos="zoom-in" > <div class="picture-box sup"> <figure class="picture-img gdz"> <div class="thumbs-b lazy"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/67906796.html" data-src="https://cdn.coder-hub.com/wp/img/33.jpg"></a></div> </figure> <h2 class="grid-title gdz"><a href="https://go.coder-hub.com/67906796.html" rel="bookmark">使用chi路由器在golang API上进行过滤。</a></h2> <span class="grid-inf gdz"> <span class="grid-author"><a href="https://go.coder-hub.com/author/huangapple" rel="author"> <span class="meta-author grid-meta-author"> <span class="meta-author-avatar load"> <img class="avatar photo" src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=" alt="huangapple" width="96" height="96" data-original="https://go.coder-hub.com/wp-content/uploads/2023/08/1_avatar-96x96.png" /> </span> </span> </a> </span> <span class="g-cat"><a href="https://go.coder-hub.com/category/go">go</a></span> <span class="grid-inf-l"> <span class="views"><i class="be be-eye ri"></i>93</span> <span class="date"><time datetime="2021-06-09 23:01:29">06/09</time></span> </span> </span> <div class="clear"></div> </div> </article> <article id="post-88103" class="post-item-list post picture scl" data-aos="zoom-in" > <div class="picture-box sup"> <figure class="picture-img gdz"> <div class="thumbs-b lazy"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/72978660.html" data-src="https://cdn.coder-hub.com/wp/img/6.jpg"></a></div> </figure> <h2 class="grid-title gdz"><a href="https://go.coder-hub.com/72978660.html" rel="bookmark">使用`*[]Item`作为参数类型是正确的,因为切片(Slice)默认是指针类型。</a></h2> <span class="grid-inf gdz"> <span class="grid-author"><a href="https://go.coder-hub.com/author/huangapple" rel="author"> <span class="meta-author grid-meta-author"> <span class="meta-author-avatar load"> <img class="avatar photo" src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=" alt="huangapple" width="96" height="96" data-original="https://go.coder-hub.com/wp-content/uploads/2023/08/1_avatar-96x96.png" /> </span> </span> </a> </span> <span class="g-cat"><a href="https://go.coder-hub.com/category/go">go</a></span> <span class="grid-inf-l"> <span class="views"><i class="be be-eye ri"></i>74</span> <span class="date"><time datetime="2022-07-14 17:58:42">07/14</time></span> </span> </span> <div class="clear"></div> </div> </article> <article id="post-89509" class="post-item-list post picture scl" data-aos="zoom-in" > <div class="picture-box sup"> <figure class="picture-img gdz"> <div class="thumbs-b lazy"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/74206618.html" data-src="https://cdn.coder-hub.com/wp/img/19.jpg"></a></div> </figure> <h2 class="grid-title gdz"><a href="https://go.coder-hub.com/74206618.html" rel="bookmark">Golang TLS测试,服务器和客户端在每次执行时协商相同的密钥,以便于调试。</a></h2> <span class="grid-inf gdz"> <span class="grid-author"><a href="https://go.coder-hub.com/author/huangapple" rel="author"> <span class="meta-author grid-meta-author"> <span class="meta-author-avatar load"> <img class="avatar photo" src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=" alt="huangapple" width="96" height="96" data-original="https://go.coder-hub.com/wp-content/uploads/2023/08/1_avatar-96x96.png" /> </span> </span> </a> </span> <span class="g-cat"><a href="https://go.coder-hub.com/category/go">go</a></span> <span class="grid-inf-l"> <span class="views"><i class="be be-eye ri"></i>150</span> <span class="date"><time datetime="2022-10-26 18:55:03">10/26</time></span> </span> </span> <div class="clear"></div> </div> </article> </div> <div class="clear"></div> <div class="apc-posts-navigation" data-aos="zoom-in" > <div class='clear ajax-navigation'></div><div data-paged='1' data-next='2' class=' apc-post-item-load-more'><span class='apc-load-more'><i class='be be-more'></i></span></div> <div class='clear'></div> </div> </section> </div> </div> </div> </div> </div> <div class="slider-rolling-box ms betip" data-aos=fade-up> <div id="slider-rolling" class="owl-carousel be-rolling single-rolling"> <div id="post-104802" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881483.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/19.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881483.html" target="_blank" rel="bookmark">What's the correct way to type hint an empty list as a literal in python?</a></h2> <div class="clear"></div> </div> <div id="post-104801" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881482.html" style="background-image: url(https://i.stack.imgur.com/qaeHV.png);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881482.html" target="_blank" rel="bookmark">如何在Highcharts Gantt中更改本地化的星期名称</a></h2> <div class="clear"></div> </div> <div id="post-104797" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881472.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/19.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881472.html" target="_blank" rel="bookmark">如何在同一个流中使用多个过滤器和映射函数?</a></h2> <div class="clear"></div> </div> <div id="post-104794" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881464.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/11.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881464.html" target="_blank" rel="bookmark">如何使用Map/Set来将代码优化到O(n)?</a></h2> <div class="clear"></div> </div> <div id="post-104788" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881458.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/11.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881458.html" target="_blank" rel="bookmark">.NET MAUI Android在GitHub Actions上构建失败,错误代码为1。</a></h2> <div class="clear"></div> </div> <div id="post-104782" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881430.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/2.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881430.html" target="_blank" rel="bookmark">如何在Playwright视觉比较中屏蔽多个定位器?</a></h2> <div class="clear"></div> </div> <div id="post-104777" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881423.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/5.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881423.html" target="_blank" rel="bookmark">在C++中,可以使用可变模板参数来检索类型的内部类型。</a></h2> <div class="clear"></div> </div> <div id="post-104775" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881422.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/13.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881422.html" target="_blank" rel="bookmark">selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: stale element not found</a></h2> <div class="clear"></div> </div> <div id="post-104768" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76881370.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/1.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76881370.html" target="_blank" rel="bookmark">Creating and opening a URL to log in to Website via Basic Auth with Robot Framework/Selenium (Python)</a></h2> <div class="clear"></div> </div> <div id="post-104316" class="post-item-list post scrolling-img"> <div class="scrolling-thumbnail"><div class="thumbs-sg"><a class="thumbs-back sc" rel="external nofollow" href="https://go.coder-hub.com/76879368.html" style="background-image: url(https://cdn.coder-hub.com/wp/img/32.jpg);"></a></div></div> <div class="clear"></div> <h2 class="grid-title over"><a href="https://go.coder-hub.com/76879368.html" target="_blank" rel="bookmark">AG Grid 在上下文菜单中以大文本形式打开</a></h2> <div class="clear"></div> </div> </div> </div> <!-- 引用 --> <div id="comments" class="comments-area"> <div class="scroll-comments"></div> <div id="respond" class="comment-respond ms" data-aos=fade-up> <form action="https://go.coder-hub.com/wp-comments-post.php" method="post" id="commentform"> <div class="comment-user-inf"> <div class="user-avatar load"> <img alt="匿名" src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=" data-original="https://go.coder-hub.com/wp-content/themes/begin/img/favicon.png"> </div> <div class="comment-user-inc"> <h3 id="reply-title" class="comment-reply-title"><span>发表评论</span></h3> <span class="comment-user-name">匿名网友</span> <span class="comment-user-alter"></span> </div> </div> <div class="gravatar-apply"> <a href="https://weavatar.com/" rel="external nofollow" target="_blank" title="申请头像"></a> </div> <div class="comment-form-comment"> <textarea id="comment" class="dah" name="comment" rows="4" tabindex="30" placeholder="赠人玫瑰,手留余香..." onfocus="this.placeholder=''" onblur="this.placeholder='赠人玫瑰,手留余香...'"></textarea> <p class="comment-tool"> <a class="tool-img dahy" href='javascript:embedImage();' title="图片"><i class="icon-img"></i><i class="be be-picture"></i></a> <a class="emoji dahy" href="" title="表情"><i class="be be-insertemoticon"></i></a> <span class="pre-button" title="代码高亮"><span class="dashicons dashicons-editor-code"></span></span> <p class="emoji-box"> <script type="text/javascript"> function grin(obj) { var val = document.getElementById('comment').value; document.getElementById('comment').value = val + " " + obj + " "; } </script> <a href="javascript:grin(':?:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_question.gif" alt=":?:" title="疑问" /></a> <a href="javascript:grin(':razz:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_razz.gif" alt=":razz:" title="调皮" /></a> <a href="javascript:grin(':sad:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_sad.gif" alt=":sad:" title="难过" /></a> <a href="javascript:grin(':evil:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_evil.gif" alt=":evil:" title="抠鼻" /></a> <a href="javascript:grin(':!:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_exclaim.gif" alt=":!:" title="吓" /></a> <a href="javascript:grin(':smile:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_smile.gif" alt=":smile:" title="微笑" /></a> <a href="javascript:grin(':oops:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_redface.gif" alt=":oops:" title="憨笑" /></a> <a href="javascript:grin(':grin:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_biggrin.gif" alt=":grin:" title="坏笑" /></a> <a href="javascript:grin(':eek:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_surprised.gif" alt=":eek:" title="惊讶" /></a> <a href="javascript:grin(':shock:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_eek.gif" alt=":shock:" title="发呆" /></a> <a href="javascript:grin(':???:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_confused.gif" alt=":???:" title="撇嘴" /></a> <a href="javascript:grin(':cool:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_cool.gif" alt=":cool:" title="大兵" /></a> <a href="javascript:grin(':lol:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_lol.gif" alt=":lol:" title="偷笑" /></a> <a href="javascript:grin(':mad:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_mad.gif" alt=":mad:" title="咒骂" /></a> <a href="javascript:grin(':twisted:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_twisted.gif" alt=":twisted:" title="发怒" /></a> <a href="javascript:grin(':roll:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_rolleyes.gif" alt=":roll:" title="白眼" /></a> <a href="javascript:grin(':wink:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_wink.gif" alt=":wink:" title="鼓掌" /></a> <a href="javascript:grin(':idea:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_idea.gif" alt=":idea:" title="酷" /></a> <a href="javascript:grin(':arrow:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_arrow.gif" alt=":arrow:" title="擦汗" /></a> <a href="javascript:grin(':neutral:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_neutral.gif" alt=":neutral:" title="亲亲" /></a> <a href="javascript:grin(':cry:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_cry.gif" alt=":cry:" title="大哭" /></a> <a href="javascript:grin(':mrgreen:')"><img src="https://go.coder-hub.com/wp-content/themes/begin/img/smilies/icon_mrgreen.gif" alt=":mrgreen:" title="呲牙" /></a> <br /> </p> <div class="add-img-box"> <div class="add-img-main"> <div><textarea class="img-url dah" rows="3" placeholder="图片地址" value=" + "/></textarea></div> <div class="add-img-but dah">确定</div> <span class="arrow-down"></span> </div> </div> </p> </div> <div id="comment-author-info" class="comment-info"> <p class="comment-form-author pcd"> <label class="dah" for="author">昵称</span></label> <input type="text" name="author" id="author" class="commenttext dah" value="" tabindex="31" required="required" /> <span class="required"><i class="be be-personoutline"></i></span> </p> <p class="comment-form-email pcd"> <label class="dah" for="email">邮箱</label> <input type="text" name="email" id="email" class="commenttext dah" value="" tabindex="32" required="required" /> <span class="required"><i class="be be-email"></i></span> </p> <p class="comment-form-url pcd qqcd"> <label class="dah" for="url">网址</label> <input type="text" name="url" id="url" class="commenttext dah" value="" tabindex="33" /> <span class="required"><i class="be be-link"></i></span> </p> <p class="comment-form-url"> <label class="dah no-label" for="url">Address <input type="text" id="address" class="dah address" name="address" placeholder=""> </label> </p> <div class="clear"></div> </div> <p class="form-submit"> <input id="submit" class="bk dah" name="submit" type="submit" value="提交"/> <span class="cancel-reply"><a rel="nofollow" id="cancel-comment-reply-link" href="/31909291.html#respond" style="display:none;">取消</a></span> </p> <div class="qaptcha-box"> <div class="unlocktip" data-hover="滑动解锁"></div> <div class="qaptcha"></div> </div> <input type='hidden' name='comment_post_ID' value='75697' id='comment_post_ID' /> <input type='hidden' name='comment_parent' id='comment_parent' value='0' /> </form> </div> </div> <!-- #comments --> </main> </div> </div> <div class="clear"></div> <footer id="colophon" class="site-footer" role="contentinfo"> <div class="site-info"> <div class="site-copyright"> <p style="text-align: center;">Copyright ©  开发者交流平台 版权所有.</p> <p style="text-align: center;"> </div> <div class="add-info"> <div class="clear"></div> <span class="yb-info"> <a href="https://beian.miit.gov.cn/" rel="external nofollow" target="_blank">闽 ICP 备 2022019110 号 - 1 </a> </span> </div> <div class="clear"></div> </div> <ul id="scroll" class="scroll scroll-but"> <li><a class="scroll-h ms fo"><i class="be be-arrowup"></i></a></li> <li><a class="scroll-b ms fo"><i class="be be-arrowdown"></i></a></li> <li class="foh"><a class="scroll-c fo"><i class="be be-speechbubble"></i></a></li> <ul class="night-day"> <li class="foh"><span class="night-main"><a class="m-night fo ms"><span class="m-moon"><span></span></span></a></span></li> <li class="foh"><a class="m-day fo ms"><i class="be be-loader"></i></a></li> </ul> <li class="qrshow foh"> <a class="qrurl ms fo"><i class="be be-qr-code"></i></a> <span class="qrurl-box"> <img id="qrious"> <span class="logo-qr"><img src="https://go.coder-hub.com/wp-content/uploads/2023/08/cropped-v2-46d9eaf887cea850a9211ed7e8b3168b_r-1.png" alt="开发者交流平台" /></span> <p>本页二维码</p> <span class="arrow-right"></span> </span> </li> </ul> <script type='text/javascript' id='superfish-js-after'>var fallwidth = {fall_width: 190}</script> <script type="text/javascript">var QaptchaJqueryPage="https://go.coder-hub.com/wp-content/themes/begin/inc/qaptcha.jquery.php"</script> <script>window._betip = { uri:"https://go.coder-hub.com/wp-content/themes/begin/" }</script><script type="text/javascript" id="wp-postviews-cache-js-extra"> /* <![CDATA[ */ var viewsCacheL10n = {"admin_ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php","nonce":"35b1da9db9","post_id":"75697"}; /* ]]> */ </script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/plugins/wp-postviews/postviews-cache.js?ver=1.77" id="wp-postviews-cache-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-includes/js/clipboard.min.js?ver=2.0.11" id="clipboard-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/superfish.js?ver=2023/08/22" id="superfish-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/begin-script.js?ver=2023/08/22" id="be_script-js"></script> <script type="text/javascript" id="be_script-js-after"> /* <![CDATA[ */ var ajax_content = {"ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"};var Offset = {"header_h":"80"};var aosstate = {"aos":"0"}; var bea_ajax_params = {"bea_ajax_nonce":"5c78e15ac8","bea_ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"};var be_mail_contact_form = {"mail_ajaxurl":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"};var ajax_sort = {"ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"};var random_post = {"ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"};var ajax_ac = {"ajaxurl":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"};var ajax_captcha = {"ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"};var ajax_load_login = {"ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"};var ajax_pages_login = {"ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"}; var host = {"site":"https:\/\/go.coder-hub.com"};var plt = {"time":"30"}; var copiedurl = {"copied":"\u5df2\u590d\u5236"};var copiedlink = {"copylink":"\u590d\u5236\u94fe\u63a5"}; /* ]]> */ </script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/ajax-tab.js?ver=2023/08/22" id="ajax_tab-js"></script> <script type="text/javascript" id="ajax_tab-js-after"> /* <![CDATA[ */ var ajax_tab = {"ajax_url":"https:\/\/go.coder-hub.com\/wp-admin\/admin-ajax.php"}; var Ajax_post_id = {"post_not_id":75697}; /* ]]> */ </script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/qrious.js?ver=2023/08/22" id="qrious-js-js"></script> <script type="text/javascript" id="qrious-js-js-after"> /* <![CDATA[ */ var ajaxqrurl = {"qrurl":"1"}; /* ]]> */ </script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/owl.js?ver=2023/08/22" id="owl-js"></script> <script type="text/javascript" id="owl-js-after"> /* <![CDATA[ */ var Timeout = {"owl_time":"4000"};var gridcarousel = {"grid_carousel_f":"4"};var flexiselitems = {"flexisel_f":"5"};var slider_items_n = {"slider_sn":"4"}; /* ]]> */ </script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/sticky.js?ver=2023/08/22" id="sticky-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/ias.js?ver=2023/08/22" id="ias-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/nice-select.js?ver=2023/08/22" id="nice-select-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/fancybox.js?ver=2023/08/22" id="fancybox-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/copy-code.js?ver=2023/08/22" id="copy-code-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/prettify.js?ver=2023/08/22" id="prettify-js"></script> <script type="text/javascript" id="social-share-js-before"> /* <![CDATA[ */ var beshare_opt="|https%3A%2F%2Fgo.coder-hub.com%2Fwp-content%2Fthemes%2Fbegin|0|https%3A%2F%2Fgo.coder-hub.com%2Fwp-admin%2Fadmin-ajax.php|75697"; var be_beshare_donate_html='<div class="tab-navs"><div class="share-tab-nav-item item-alipay current"><i class="cx cx-alipay"></i><span class="wyc">\u652f\u4ed8\u5b9d</span></div><div class="share-tab-nav-item item-weixin"><i class="cx cx-weixin"></i><span class="wyc">\u5fae\u4fe1</span></div></div><div class="share-tab-conts"><div class="share-tab-cont current"><div class="give-qr"><img src="https://cdn.coder-hub.com/static/ali.png" alt="\u652f\u4ed8\u5b9d\u4e8c\u7ef4\u7801"></div><p>\u652f\u4ed8\u5b9d\u626b\u63cf\u4e8c\u7ef4\u7801\u6253\u8d4f\u4f5c\u8005</p></div><div class="share-tab-cont"><div class="give-qr"><img src="https://cdn.coder-hub.com/static/wx.png" alt="\u5fae\u4fe1\u4e8c\u7ef4\u7801"></div><p>\u5fae\u4fe1\u626b\u63cf\u4e8c\u7ef4\u7801\u6253\u8d4f\u4f5c\u8005</p></div></div>';var be_share_html='<div class="be-share-list" data-cover="https://go.coder-hub.com/wp-content/themes/begin/img/default/random/320.jpg"><a class="share-logo ico-weixin" data-cmd="weixin" title="\u5206\u4eab\u5230\u5fae\u4fe1" rel="external nofollow"></a><a class="share-logo ico-weibo" data-cmd="weibo" title="\u5206\u4eab\u5230\u5fae\u535a" rel="external nofollow"></a><a class="share-logo ico-qzone" data-cmd="qzone" title="\u5206\u4eab\u5230QQ\u7a7a\u95f4" rel="external nofollow"></a><a class="share-logo ico-qq" data-cmd="qq" title="\u5206\u4eab\u5230QQ" rel="external nofollow"></a>'; /* ]]> */ </script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/social-share.js?ver=2023/08/22" id="social-share-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/jquery-ui.js?ver=2023/08/22" id="jquery-ui-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/qaptcha.js?ver=2023/08/22" id="qaptcha-js"></script> <script type="text/javascript" id="comments_ajax-js-before"> /* <![CDATA[ */ var aqt = {"qt":"1"};var ajaxcomment = {"ajax_php_url":"https:\/\/go.coder-hub.com\/wp-content\/themes\/begin\/inc\/comment-ajax.php"}; /* ]]> */ </script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/comments-ajax.js?ver=2023/08/22" id="comments_ajax-js"></script> <script type="text/javascript" src="https://go.coder-hub.com/wp-content/themes/begin/js/captcha-email.js?ver=2023/08/22" id="login-js"></script> </footer> </div> </body> </html><!-- Performance optimized by Redis Object Cache. Learn more: https://wprediscache.com 使用 Predis (v2.1.2) 从 Redis 检索了 2428 个对象 (2 MB)。 --> <!-- WP Fastest Cache file was created in 2.4045400619507 seconds, on 22-11-24 19:53:25 --><!-- need to refresh to see cached version -->