Lost print()s

We are faced with a serious problem in the Editor-2.
We work daily in a bunch of “Editor-2 + Atom” and use print() for debugging.
Recently, we are constantly confronted with the fact that the console does not print print(), which we write in the lua-scripts.

Sometimes we are helped to delete the build cache and restart the editor. But it’s rather inconvenient to do after each new added line of code.

Often there is a situation where the print() is not printed right before the wrong line.
Perhaps you fold the prints in queue and critical errors prevent them from getting out?

Now these problems have become very critical.

Our systems - Win8 and Win10.
The amount of code in our project with which we work is about 1 mb, more than 100 lua-modules.

2 Likes

Hi @morgerion,

Thanks for the report. I’ve created an issue to track this (https://github.com/defold/editor2-issues/issues/1375) and marked it as a blocker. We will investigate.

4 Likes

Hi again @morgerion,

A question to help us troubleshoot:

  • Does this happen when running on a local target, device or both?

On local target, Windows PC in our case.

1 Like

This is screenshot of typical case:

As you can see, the lines “111 map_handlers” and “222 map_handlers” is not displayed, although the rest works.

1 Like

And you are certain that that section of code is running? Place an os.exit() call and check that the app shuts down.

This is just one example that I photographed in September. There were many such cases before and after.
The situation has always been repeated: we are debugging a piece of code and at some point the print()s are no longer displayed in the console.

After that we delete the cache, reboot the computer and reinstall Defold. Sometimes it helps. Sometimes not.

Strange. I’ve seen examples of where the console gets slowed down by many prints but not ever any lost print statements. What if you print() to file instead? I would guess that that works as expected.

1 Like

An important clarification: it’s about any code, not just about print()s!
A typical situation looks like this:

  1. We detect a bug.
  2. We write one line of code that fixes it, save all.
  3. Rebuild and start - no changes! (seems like editor ignore p.2)
  4. Delete the cache, restart the engine, rebuild - it works!
1 Like

Oh, I thought it was only prints not showing in the console. What you describe is a completely different thing. I defer this to @Ragnar_Dahlen then…

Thanks for clarifying @morgerion. Will keep you posted.

2 Likes

@morgerion I’ve been trying hard to reproduce this but can’t. Have tried Windows 10 with Atom.

One question: Is your project stored in a local directory on disk, or on some kind of networked volume?

1 Like

Yes, our project stored in a local directory on disk.
And yes, the problem still remains. Perhaps this is due to the fact that the project is big.

I can assume that the text editor updates the content autonomously from the builder. Thus, the code on the editor has already been updated, but the old one is used for the compiler. There is a feeling that the compiler ignores the latest changes in the text of the code.

1 Like

I am having the same problem with the new editor, no print outs in the console.

I dont have any undo history eather.

And when editing a long row that is scrolled the scroll position is reset to beginning ow row whenever i enter a char on that row…

1 Like

@morgerion @geidnert We have sadly not been able to reproduce this issue. I’m guessing it has something to do with how we reload resources after detecting an external change, and the way your project is structured.
Is there any chance we could have a look at your project? Or a smaller project where this happens?

About undo. When reloading external changes we assume the undo information we hold is invalid and simply wipe it. Thats why you have no undo when using an external editor.
And the scrolling issue, well, we’ve honestly pretty much abandoned the current text editor in preference for a much improved to be released soonish :slight_smile:

3 Likes

Give your email and I will give you access to the project in the Defold console.
How to catch “not updating” sources:

  1. open source in the atom (+ luacheck)
  2. сhange one line, in example add some print()
  3. save source
  4. switch to Defold, wait until the source update is displayed
  5. build and run
  6. repeat many times
  7. oops - at some point the source code changes will not be included in the build!
1 Like

Does it only happen when using an external editor?

In both cases.
As a rule, this happens in large files (AbstractWindowLogic.lua, craft_gui.gui_script, ProcessLogic.lua, shop.gui_script) that contain many inclusions of other modules.

Bug still reproduced.
For now I helping guys with their big project (Family Age) and this bug reproduced often enough (with this project only).
I am working mac, and using only Defold editor 2 (without any external editor)