Strange behaviour with assert()

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Strange behaviour with assert()

MichaelAtOz
Administrator
I was playing with assert() and got something funny.

After Preview this is expected:


But press F5 five more times, and you get:


On a previous occasion the following was true, but it is not happening now. It stays that way until you add or delete a line in the editor. Adding/changing text on an existing line does not have that effect.

This could be assert() or maybe console output. But generating an error, like referencing an unknown variable, does not behave the same.

On 2017.01.20/64 W64
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

kintel
Administrator

> On Feb 23, 2017, at 21:12, MichaelAtOz <[hidden email]> wrote:
>
> I was playing with assert() and got something funny.
>
I guess we should prioritize fixing this:
https://github.com/openscad/openscad/issues/454

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

MichaelAtOz
Administrator
It is somewhat different, you get the error the first time, and the next four times, it is the fifth when the msg disappears...
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

nophead
It is very weird. Flushing the caches does not get it back but pressing F6 twice does!

On 24 February 2017 at 05:10, MichaelAtOz <[hidden email]> wrote:
It is somewhat different, you get the error the first time, and the next four
times, it is the fifth when the msg disappears...



-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
View this message in context: http://forum.openscad.org/Strange-behaviour-with-assert-tp20545p20547.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

nophead
Perhaps this line is to blame: https://github.com/openscad/openscad/blob/4a0ac7b2fa6e8ca390e3b95e1c2d2541cf9d77af/src/printutils.cc#L62

if (i == 5) return; // Suppress output after 5 equal ERROR or WARNING outputs.

On 24 February 2017 at 08:37, nop head <[hidden email]> wrote:
It is very weird. Flushing the caches does not get it back but pressing F6 twice does!

On 24 February 2017 at 05:10, MichaelAtOz <[hidden email]> wrote:
It is somewhat different, you get the error the first time, and the next four
times, it is the fifth when the msg disappears...



-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
View this message in context: http://forum.openscad.org/Strange-behaviour-with-assert-tp20545p20547.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

tp3
In reply to this post by nophead
Yes, that's unrelated to the error caching topic. I've seen this
too before but could not really pin-point how that happens.

It might be some race condition in the console handling as this
tries to overwrite and restore output streams when compiling.
https://github.com/openscad/openscad/blob/master/src/mainwin.cc#L2788

On Linux that missing output might end up on the terminal window
if OpenSCAD was started from there.
A similar effect happens with long running F6 and pressing CTRL-S.

I guess changing that might be a bigger project, maybe even
including separating console log and application output. This
could also allow to at least prevent HTML support for the log
output.

ciao,
  Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

nophead
In reply to this post by nophead
F6 fixes it because it adds "WARNING: no top level geometry", so the circular buffer no longer has five messages the same. I think the buffer should be cleared each time a new compilation is started.

On 24 February 2017 at 10:05, nop head <[hidden email]> wrote:
Perhaps this line is to blame: https://github.com/openscad/openscad/blob/4a0ac7b2fa6e8ca390e3b95e1c2d2541cf9d77af/src/printutils.cc#L62

if (i == 5) return; // Suppress output after 5 equal ERROR or WARNING outputs.

On 24 February 2017 at 08:37, nop head <[hidden email]> wrote:
It is very weird. Flushing the caches does not get it back but pressing F6 twice does!

On 24 February 2017 at 05:10, MichaelAtOz <[hidden email]> wrote:
It is somewhat different, you get the error the first time, and the next four
times, it is the fifth when the msg disappears...



-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
View this message in context: http://forum.openscad.org/Strange-behaviour-with-assert-tp20545p20547.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

nophead
Added lastmessages.clear() into resetPrintedDepracations() seems to fix it, although perhaps the name of the function should be changed to resetPrintCounts or something.

void resetPrintedDeprecations()
{
    printedDeprecations.clear();
    lastmessages.clear();
}


On 24 February 2017 at 10:10, nop head <[hidden email]> wrote:
F6 fixes it because it adds "WARNING: no top level geometry", so the circular buffer no longer has five messages the same. I think the buffer should be cleared each time a new compilation is started.

On 24 February 2017 at 10:05, nop head <[hidden email]> wrote:
Perhaps this line is to blame: https://github.com/openscad/openscad/blob/4a0ac7b2fa6e8ca390e3b95e1c2d2541cf9d77af/src/printutils.cc#L62

if (i == 5) return; // Suppress output after 5 equal ERROR or WARNING outputs.

On 24 February 2017 at 08:37, nop head <[hidden email]> wrote:
It is very weird. Flushing the caches does not get it back but pressing F6 twice does!

On 24 February 2017 at 05:10, MichaelAtOz <[hidden email]> wrote:
It is somewhat different, you get the error the first time, and the next four
times, it is the fifth when the msg disappears...



-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
View this message in context: http://forum.openscad.org/Strange-behaviour-with-assert-tp20545p20547.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

nophead
As an aside I could make this a PR, but as I have another PR outstanding how do I manage that in git? Do I do a new branch from master, if so how do I get both fixes in my local build if they are on separate git branches.

On 24 February 2017 at 10:51, nop head <[hidden email]> wrote:
Added lastmessages.clear() into resetPrintedDepracations() seems to fix it, although perhaps the name of the function should be changed to resetPrintCounts or something.

void resetPrintedDeprecations()
{
    printedDeprecations.clear();
    lastmessages.clear();
}


On 24 February 2017 at 10:10, nop head <[hidden email]> wrote:
F6 fixes it because it adds "WARNING: no top level geometry", so the circular buffer no longer has five messages the same. I think the buffer should be cleared each time a new compilation is started.

On 24 February 2017 at 10:05, nop head <[hidden email]> wrote:
Perhaps this line is to blame: https://github.com/openscad/openscad/blob/4a0ac7b2fa6e8ca390e3b95e1c2d2541cf9d77af/src/printutils.cc#L62

if (i == 5) return; // Suppress output after 5 equal ERROR or WARNING outputs.

On 24 February 2017 at 08:37, nop head <[hidden email]> wrote:
It is very weird. Flushing the caches does not get it back but pressing F6 twice does!

On 24 February 2017 at 05:10, MichaelAtOz <[hidden email]> wrote:
It is somewhat different, you get the error the first time, and the next four
times, it is the fifth when the msg disappears...



-----
Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
View this message in context: http://forum.openscad.org/Strange-behaviour-with-assert-tp20545p20547.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org






_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
tp3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange behaviour with assert()

tp3
Ah, good catch, that perfectly matches the issue description.

> As an aside I could make this a PR, but as I have another
> PR outstanding how do I manage that in git? Do I do a new
> branch from master, if so how do I get both fixes in my
> local build if they are on separate git branches.
>
Yes, the common way would be to create another branch based
on master and create a pull request for that.

As this fix looks good I'd expect Marius to merge that
pretty quick so it might be fine to just wait for that to
show up in master and merge it back to your other local
fix branch.

Otherwise it's indeed a bit more work to have a local branch
with both fixes. I usually just create some testing branch in
case I need some version that combines multiple fixes or
features.

E.g. simply:
  git checkout -b combined-fixes master
  git merge fix1 fix2

There might be better ways to do that, but as I don't need
that very often, I did not research much into that direction.

ciao,
  Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Loading...