热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在运行xdebug时,PHPUnit会冻结-PHPUnitFreezeswhenrunwithxdebugactiveandlistening

Imstrugglingsinceyesterdaywithatotallyweirdproblemwhichoccursoutofthenowhere.Imwork

Im struggling since yesterday with a totally weird problem which occurs out of the nowhere. I'm working with PHPStorm in a Symfony Project. PHPUnit Tests are running as usual. If i activate the listening mode in the IDE for debugger connections and run the tests phpunit freezes and the IDE stops automatically after 30seconds. I think it has nothing to do with the ide. If i use MacGDBp i'm experiencing the same. I've checked all Firewall related stuff on my OSX 10.11 and installed php in a new Brew environment. PHP is Version 5.6 from the local OSX and from Brew.

我从昨天起就一直在为一个莫名其妙的问题而烦恼。我正在和PHPStorm合作一个共生项目。PHPUnit测试照常运行。如果我在IDE中为调试器连接激活监听模式并运行测试phpunit,那么IDE将在30秒后自动停止。我认为这和ide没有关系。如果我使用MacGDBp,我也会有同样的体验。我检查了我的OSX 10.11上所有防火墙相关的东西,并在新的Brew环境中安装了php。PHP版本5.6来自本地OSX和Brew。

I'm fairly blind without an debugger :-o

没有调试器,我是相当盲目的:-o

3 个解决方案

#1


0  

Make sure you don't already have another debug session running in the background.

确保您没有在后台运行另一个调试会话。

#2


0  

Xdebug can only listen to one running PHP process at a time. There are usually two possibilities for this.

Xdebug一次只能监听一个正在运行的PHP进程。通常有两种可能。

1) As @adrianGW says, there could be another process already attached to the debugger.

1)正如@adrianGW所说,调试器可能已经附加了另一个进程。

2) Your program tries to load another PHP process and that process can't start until xdebug releases the current thread. This is common that PHPunit will run tests in their own threads so they don't mess up each others envs. Or your are making an http request in your application to a php script on the same server, and that second request is waiting for the first to finish so you are locked until the first script times ou

2)程序试图加载另一个PHP进程,直到xdebug释放当前线程为止,该进程才能启动。PHPunit通常会在自己的线程中运行测试,这样它们就不会互相搞砸env。或者,您在应用程序中向同一个服务器上的php脚本发出一个http请求,第二个请求等待第一个完成,所以您被锁定到第一个脚本时间ou。

There are two fixes in PHPstorm:

PHPstorm有两个补丁:

1) You can change Max Simultaneous Conections to a number greater than 1

1)您可以将最大同时接收次数更改为大于1

2) You can enable Ignore external connections through unregistered servers configurations, but this will only work if the reason for the additional threads is something like a request to another domain on the same server, which xdebug can differentiate as an unregistered server.

2)可以通过未注册的服务器配置启用忽略外部连接,但只有当附加线程的原因类似于对同一服务器上的另一个域的请求(xdebug可以将其区别为未注册的服务器)时,这才会有效。

#3


0  

For me, the cause was @runTestsInSeparateProcesses.

对我来说,原因是@ runtestsinseparation ateprocess。

Here was the symptom: when I turn on debugging in Netbeans and then run export XDEBUG_COnFIG="idekey=netbeans-xdebug remote_connect_back=0 remote_host=10.0.2.2" and then phpunit tests/Unit/MarkAsScheduledUnitTest.php --filter=testHandleExceptionWithMocking, it just outputs "PHPUnit 7.1.2 by Sebastian Bergmann and contributors." and a blinking cursors and hangs there. When I go into Netbeans and quit the debugging, the phpunit test then runs.

症状如下:当我在Netbeans中打开调试,然后运行export XDEBUG_COnFIG="idekey= " Netbeans -xdebug remote_connect_back=0 remote_host=10.0.2.2",然后phpunit test /Unit/MarkAsScheduledUnitTest。php -filter= testhandleexceptionwithmock,它只输出“由Sebastian Bergmann和贡献者编写的PHPUnit 7.1.2”和一个闪烁的游标并挂在那里。当我进入Netbeans并停止调试时,phpunit测试就会运行。

The solution was so temporarily remove @runTestsInSeparateProcesses any time I'm running just that one test or class of tests (rather than the whole suite of tests).

解决方案是在我运行一个测试或测试类(而不是整个测试套件)时临时删除@ runtestsinseparation ateprocess。

https://stackoverflow.com/a/37464247/470749 explains why I'm using @runTestsInSeparateProcesses at all.

https://stackoverflow.com/a/37464247/470749解释了我为什么使用@ runtestsinsecateprocess。

Xdebug breakpoints always work except when using @runTestsInSeparateProcesses? is giving me ideas for how to more easily run a single test without temporarily removing @runTestsInSeparateProcesses.

除了使用@ runtestsinseparation ateprocess之外,Xdebug断点始终有效吗?是关于如何在不临时删除@ runtestsinseparation ateprocess的情况下更容易地运行单个测试的想法。


推荐阅读
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • 本文介绍了Redis的基础数据结构string的应用场景,并以面试的形式进行问答讲解,帮助读者更好地理解和应用Redis。同时,描述了一位面试者的心理状态和面试官的行为。 ... [详细]
  • 本文介绍了计算机网络的定义和通信流程,包括客户端编译文件、二进制转换、三层路由设备等。同时,还介绍了计算机网络中常用的关键词,如MAC地址和IP地址。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • Python瓦片图下载、合并、绘图、标记的代码示例
    本文提供了Python瓦片图下载、合并、绘图、标记的代码示例,包括下载代码、多线程下载、图像处理等功能。通过参考geoserver,使用PIL、cv2、numpy、gdal、osr等库实现了瓦片图的下载、合并、绘图和标记功能。代码示例详细介绍了各个功能的实现方法,供读者参考使用。 ... [详细]
  • 深入理解Kafka服务端请求队列中请求的处理
    本文深入分析了Kafka服务端请求队列中请求的处理过程,详细介绍了请求的封装和放入请求队列的过程,以及处理请求的线程池的创建和容量设置。通过场景分析、图示说明和源码分析,帮助读者更好地理解Kafka服务端的工作原理。 ... [详细]
  • 本文介绍了如何使用Express App提供静态文件,同时提到了一些不需要使用的文件,如package.json和/.ssh/known_hosts,并解释了为什么app.get('*')无法捕获所有请求以及为什么app.use(express.static(__dirname))可能会提供不需要的文件。 ... [详细]
  • 本文讨论了如何在codeigniter中识别来自angularjs的请求,并提供了两种方法的代码示例。作者尝试了$this->input->is_ajax_request()和自定义函数is_ajax(),但都没有成功。最后,作者展示了一个ajax请求的示例代码。 ... [详细]
  • 先看看ElementUI里关于el-table的template数据结构:<template><el-table:datatableData><e ... [详细]
  • Spring常用注解(绝对经典),全靠这份Java知识点PDF大全
    本文介绍了Spring常用注解和注入bean的注解,包括@Bean、@Autowired、@Inject等,同时提供了一个Java知识点PDF大全的资源链接。其中详细介绍了ColorFactoryBean的使用,以及@Autowired和@Inject的区别和用法。此外,还提到了@Required属性的配置和使用。 ... [详细]
  • SpringMVC接收请求参数的方式总结
    本文总结了在SpringMVC开发中处理控制器参数的各种方式,包括处理使用@RequestParam注解的参数、MultipartFile类型参数和Simple类型参数的RequestParamMethodArgumentResolver,处理@RequestBody注解的参数的RequestResponseBodyMethodProcessor,以及PathVariableMapMethodArgumentResol等子类。 ... [详细]
  • Week04面向对象设计与继承学习总结及作业要求
    本文总结了Week04面向对象设计与继承的重要知识点,包括对象、类、封装性、静态属性、静态方法、重载、继承和多态等。同时,还介绍了私有构造函数在类外部无法被调用、static不能访问非静态属性以及该类实例可以共享类里的static属性等内容。此外,还提到了作业要求,包括讲述一个在网上商城购物或在班级博客进行学习的故事,并使用Markdown的加粗标记和语句块标记标注关键名词和动词。最后,还提到了参考资料中关于UML类图如何绘制的范例。 ... [详细]
  • 本文介绍了一种轻巧方便的工具——集算器,通过使用集算器可以将文本日志变成结构化数据,然后可以使用SQL式查询。集算器利用集算语言的优点,将日志内容结构化为数据表结构,SPL支持直接对结构化的文件进行SQL查询,不再需要安装配置第三方数据库软件。本文还详细介绍了具体的实施过程。 ... [详细]
  • 本文介绍了Python语言程序设计中文件和数据格式化的操作,包括使用np.savetext保存文本文件,对文本文件和二进制文件进行统一的操作步骤,以及使用Numpy模块进行数据可视化编程的指南。同时还提供了一些关于Python的测试题。 ... [详细]
  • 微软评估和规划(MAP)的工具包介绍及应用实验手册
    本文介绍了微软评估和规划(MAP)的工具包,该工具包是一个无代理工具,旨在简化和精简通过网络范围内的自动发现和评估IT基础设施在多个方案规划进程。工具包支持库存和使用用于SQL Server和Windows Server迁移评估,以及评估服务器的信息最广泛使用微软的技术。此外,工具包还提供了服务器虚拟化方案,以帮助识别未被充分利用的资源和硬件需要成功巩固服务器使用微软的Hyper - V技术规格。 ... [详细]
author-avatar
索马里7_244
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有