Giter Club home page Giter Club logo

Comments (16)

rjkroege avatar rjkroege commented on August 26, 2024

Also see #6 for yet more. General issue: Frame assumes quite consistently that the bounds max % line height is 0 and expects the caller to tend to this detail.

Observation: I wonder if the first version of Frame was fixed width / fixed height only and variable width support was retrofitted?

from edwood.

paul-lalonde avatar paul-lalonde commented on August 26, 2024

Another one. This is from executing a shell command that made a lot of output. The bad text.go line does t.fr.Delete(0, t.fr.GetFrameFillStatus().Nchars) which I would expect to aways succeed.
So: there might be a race in edwood that is changing Nchars between the GetFrameFillStatus() call the Delete(), unless Nchars is maintained incorrectly.

panic: Frame.ptofchar in Frame.delete

goroutine 4 [running]:
github.com/rjkroege/edwood/frame.(*Frame).Delete(0xc42033a360, 0x0, 0x8ee, 0x1)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/frame/delete.go:111 +0xd90
main.(*Text).setorigin(0xc420206528, 0xa1e3, 0x1)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/text.go:1640 +0x155
main.(*Text).SetOrigin(0xc420206528, 0xa1e3, 0x1)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/text.go:1604 +0x43
main.(*Text).Show(0xc420206528, 0xa33a, 0xa33a, 0x1f01)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/text.go:1264 +0x15c
main.xfidwrite.func1()
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/xfid.go:483 +0x20d
main.xfidwrite(0xc420204000)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/xfid.go:501 +0x438
main.xfidctl(0xc420204000, 0xc4200cc0c0)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/xfid.go:46 +0x87
created by main.xfidallocthread
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/acme.go:628 +0x1e5

from edwood.

paul-lalonde avatar paul-lalonde commented on August 26, 2024

In an attempt to catch a race, I instrumented Frame.Init, Delete, Insert with a global mutex. Same outcome. More evidence of Nchars getting out of sync :-(

from edwood.

paul-lalonde avatar paul-lalonde commented on August 26, 2024

And while typing in a frame just now:

panic: endofframe

goroutine 23 [running]:
github.com/rjkroege/edwood/frame.(*Frame).chop(0xc0001ab320, 0x3fd, 0x4a9, 0x6b1, 0x94)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/frame/insert.go:112 +0x16f
github.com/rjkroege/edwood/frame.(*Frame).Insert(0xc0001ab320, 0xc000478dfc, 0x1, 0x1, 0x54d)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/frame/insert.go:238 +0x1069
main.(*Text).Insert(0xc00021ed28, 0x54d, 0xc000478dfc, 0x1, 0x1, 0x0)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/text.go:475 +0x5b2
main.(*Text).Type(0xc00021ed28, 0x66)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/text.go:1011 +0x396
main.(*Window).Type(0xc00021ec00, 0xc00021ed28, 0x66)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/wind.go:419 +0x37
main.(*Row).Type(0x12e6800, 0x66, 0x52c, 0x43b, 0xc00021ed28)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/row.go:285 +0x133
main.keyboardthread(0xc0000aa0c0)
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/acme.go:464 +0x1e7
created by main.main
	/Users/plalonde/dev/src/github.com/rjkroege/edwood/acme.go:172 +0x926

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

We would appear to be running frame code from multiple go routines. In particular:

goroutine 66 [running]:
github.com/rjkroege/edwood/frame.(*Frame).cklinewrap(0x12f0340, 0x19c0, 0x333, 0x0, 0x638, 0x333)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/frame/util.go:45 +0x26
github.com/rjkroege/edwood/frame.(*Frame).drawtext(0x12f0340, 0x4ed, 0x317, 0xc4200c0770, 0xc42014c230)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/frame/draw.go:13 +0xb4
github.com/rjkroege/edwood/frame.(*Frame).Insert(0xc42036a900, 0xc420432420, 0x57, 0x58, 0x29a)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/frame/insert.go:344 +0xd7f
main.(*Text).Insert(0xc420266528, 0x29a, 0xc420432420, 0x57, 0x58, 0x1)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/text.go:475 +0x591
main.xfidwrite(0xc4203d4000)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/xfid.go:579 +0x8f4
main.xfidctl(0xc4203d4000, 0xc4200de0c0)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/xfid.go:46 +0x87
created by main.xfidallocthread
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/acme.go:628 +0x1e5

and obviously from main.keyboardthread per above.

And... frame.bxscan uses a global Frame object so there's no way it's thread safe.

from edwood.

paul-lalonde avatar paul-lalonde commented on August 26, 2024

Now, that's interesting.
We can funnel all frame changes through a chan; we could lock Text; or we could lock Frame.
Preferences? I have a small preference for the first option - the frame API is small enough to make this work in an hour of work, I think.

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

I will remove the global so that every Frame instance can proceed in parallel. And maybe funnel interaction with Text's Frame through a channel?

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

$PLAN9/bin/E still crashes sometimes. But at least now doesn't crash all the time.

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

Two additional/new issues:

  • TAB boxes are getting (wrongly) replicated.
  • Frame.chop is running past the end.

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

Attempting to delete text from an already empty box? Stack trace looks like a race condition between the filesystem thread and the a different thread?

2018/04/16 08:23:18 Frame.Delete Start p0=0 p1=108
2018/04/16 08:23:18 -- runes in boxes != NChars --
2018/04/16 08:23:18 end: -- runes in boxes != NChars -- &{0xc4201080a0 0xc4200b60c0 0xc4201260e0 [0xc420010a10 0xc42016c070 0xc42016c0e0 0xc4200107e0 0xc4200107e0] (1261,62)-(2048,118) (1261,62)-(2048,118) [] 0 0 48 108 2 2 false true 0xc4200100e0 0xc420010150 false false false 2}
panic: -- runes in boxes != NChars --

goroutine 89 [running]:
github.com/rjkroege/edwood/frame.(*Frame).validateboxmodel(0xc42027ea00, 0x11f1c2d, 0x1e, 0xc4201d5c38, 0x2, 0x2)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/frame/box.go:177 +0x41d
github.com/rjkroege/edwood/frame.(*Frame).Delete(0xc42027ea00, 0x0, 0x6c, 0x0)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/frame/delete.go:13 +0x124
main.(*Text).Delete(0xc420072818, 0x0, 0x6c, 0xc420206101)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/text.go:598 +0x3ad
main.(*Window).SetTag1(0xc420072800)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/wind.go:523 +0x438
main.(*Window).SetTag(0xc420072800)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/wind.go:462 +0x8d
main.xfidclose(0xc420120160)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/xfid.go:247 +0x233
main.xfidctl(0xc420120160, 0xc4200b60c0)
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/xfid.go:46 +0x87
created by main.xfidallocthread
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/acme.go:628 +0x1e5

from edwood.

paul-lalonde avatar paul-lalonde commented on August 26, 2024

Today I was getting actual work done with edwood.
Whenever inserting pushed a line past the current right edge of the frame, or deleting pulled text up from the line before, it would mis-render, mostly replacing text with blanks. 100% reliable. Scroll away and back, and it's fixed.

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

Visual damage: type some invalid characters and tab and there will be some pixel turds on the screen.

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

Unusual crash:

acme: text.type: <nil>                                                                                                                                                                                                             
panic: text.delete                                                                                                                                                                                                                 
                                                                                                                                                                                                                                   
goroutine 7 [running]:                                                                                                                                                                                                             
main.(*Text).Delete(0xc4202e2528, 0x1f0, 0x365, 0x101)                                                                                                                                                                             
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/text.go:553 +0x46b                                                                                                                                              
main.cut(0xc4202e2528, 0xc4202e2528, 0x0, 0x101, 0x0, 0x0)                                                                                                                                                                         
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/exec.go:320 +0x31d                                                                                                                                              
main.(*Text).Type(0xc4202e2528, 0x69)                                                                                                                                                                                              
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/text.go:881 +0x205                                                                                                                                              
main.(*Window).Type(0xc4202e2400, 0xc4202e2528, 0x69)                                                                                                                                                                              
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/wind.go:417 +0x37                                                                                                                                               
main.(*Row).Type(0x12ef600, 0x69, 0xcd, 0x17a, 0xc4202e2528)                                                                                                                                                                       
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/row.go:285 +0x139                                                                                                                                               
main.keyboardthread(0xc4200d00c0)                                                                                                                                                                                                  
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/acme.go:464 +0x1e8                                                                                                                                              
created by main.main                                                                                                                                                                                                               
        /Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/acme.go:172 +0x959            

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

Previous two issues are connected. The crash happens when the state of the page is invalid after the tab/insert.

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

Thread safety (as of b8089af) seems to improve robustness.

from edwood.

rjkroege avatar rjkroege commented on August 26, 2024

I haven't seen any crashes in Frame for weeks now. I declare this fixed

from edwood.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.