Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 31, 2021 10:55 am GMT

Remote Debugging on the Last Day of - Building DDTJ Day 10

Yesterday the DDT PoC started working, today is the last day of my two week hack fest on DDTJ Here's where we stand.

The second week is finally over and while I built a working DDT proof of concept. I wasnt able to complete a fully working MVP. The difference is that a proof of concept shows something working, an MVP needs to do something useful. DDT has yet to be realistically useful.

Making DDT useful is my main goal right now. To facilitate that, Im trying to get it to work with a Spring Boot application. So far this isnt going great, but Im making iterative progress. Running the application like we do a hello world just doesnt work. The backend is blocked and the launch method never returns.

Spring Boot has a relatively elaborate bootstrap loading phase which causes issues with debuggers. The approach is to bind a remote debugger which wasnt supported by DDTJ, so I added that support.

With remote debugging and some command line magic for spring boot, I was able to connect to the spring boot VM and got the whole thing working.

Weird Bugs

Right now Im in a bug squashing phase. Run the spring boot pet clinic app with remote debugging. Launch the backend. Connect them and find a bug. Fix, rinse, repeat.

This is tedious, but mostly running smoothly.

Unfortunately, I seem to run into issues that are very hard to debug. E.g. Unexpected JDWP Error: 32 which is thrown by the JDI implementation. This seems like an issue with stack frames, but I cant figure out why its happening.

Another problem is that on a method entry event, the stack seems to be occasionally corrupted. Where the current method isnt at the top of the stack. As far as I can tell, this isnt something that should ever happen. But I might have missed a documentation nuance.

Attaching a Debugger

We can attach a debugger using the process id with a command like:

java -jar target/CLI-0.0.6-SNAPSHOT-shaded.jar -pid=62604

Or we can use a socket. Notice the socket always connects to localhost as remote debugging is a danger over jdwp:

java -jar target/CLI-0.0.6-SNAPSHOT-shaded.jar -attach=8000

Notice that the backend should have been running before and the pet clinic demo. I used the following command for the pet clinic:

java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -jar spring-petclinic-2.5.0-SNAPSHOT.jar -Dagentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

Which might have been a bit much, but it took me forever to get the damn thing to connect through JDWP.

Upcoming PR and Where do we go Next?

This code is in a PR that still isnt running the spring boot pet clinic. As such, I dont want to commit it yet or create a PR. Unfortunately, the two-week vacation is over and I have other duties.

Ill reduce my work pace on DDT for now as I have a lot of catching up to do at work. But I plan to bring it to MVP status within 2-4 weeks. I think the slower pace might help me digest some of these issues. So overall, its probably a good thing to take a bit of a break.

I made a lot of mistakes in the past two weeks, but I think Im too close to it right now. Ill try to write a post-mortem post next week to cover what I did well and what I can improve. This wont be a summary, as I think my opinions on this will evolve further as I rethink some of my stances.

I suggest watching the ddtj project to see when it gets updated with a new PR. You can also follow me on twitter to keep up to date with the latest developments. I have some great ideas for the core technology of DDT that go well beyond testing alone. Theres a lot of untapped potential here that we need to explore.


Original Link: https://dev.to/codenameone/remote-debugging-on-the-last-day-of-building-ddtj-day-10-3i64

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To