Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why I cannot debug a code in async block in intellij #136

Open
lahirug opened this issue Aug 12, 2015 · 6 comments
Open

Why I cannot debug a code in async block in intellij #136

lahirug opened this issue Aug 12, 2015 · 6 comments
Assignees
Milestone

Comments

@lahirug
Copy link

lahirug commented Aug 12, 2015

Anybody noticed this and found a workaround ?

@efiko12
Copy link

efiko12 commented Sep 18, 2015

Yes I have the same problem, but It doesn't happen every time.

@pkolaczk
Copy link

I noticed this. Annoying as hell. Actually this is probably number 1 on my priority list. This and error handling.

@worldofprasanna
Copy link

Yes. Its very annoying. We used Play framework and everything is written within async block. It happens always for me.

@retronym
Copy link
Member

I see that the IntelliJ Scala Plugin team has just added some support for scala-async to the debugger.

JetBrains/intellij-scala@64774de
JetBrains/intellij-scala@ff04b9f

The bug report, SCL-9039, seems the be reporting the same problem you're discussing here.

As a nice bonus, @niktrop seems to have added special support in "evaluate expression" so that local variables in the user-written code are retrieved from the corresponidng name-mangled fields of the state machine class. Thanks!

@niktrop Let me know if there is anything we can do in the macro to make your life easier here..

@lahirug @efiko12 @pkolaczk @worldofprasanna Thanks for your patience with this problem. Could I ask you to test out the latest nightly of the Scala Plugin (this requires use of IDEA 15) and report whether the situation is improved?

@retronym retronym added bug task and removed bug labels Nov 17, 2015
@retronym retronym self-assigned this Nov 17, 2015
@niktrop
Copy link

niktrop commented Nov 17, 2015

There are some problems with availability of local variables and fields. Try this example:

object AsyncBugs {
  def main(args: Array[String]) {
    val future = async {
      val f1 = async { false }
      val f2 = async { 42 }
      if (await(f1))
        await(f2)
      else {
        "Hi" //breakpoint here
      }
    }

    Await.result(future, Duration.Inf)
  }
}

Field, generated for f2 is already null. And local variable f1 is not visible from the breakpoint location. I suppose wrong debug info for local variable table is generated.

@pkolaczk
Copy link

With the recent plugin I can put a breakpoint inside of async block and now it properly stops there. However, I noticed I can't step over await calls. Much better than before, but still needs more work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants