Updates

Input is Conflicting with Concurrent Modification

After loading Pier for a production site it is a good idea to start Persistency, so it can survive a crash. Unfortunately adding a new component causes an error similar to Conflict in Memento.

Created a test as:

MACheckedMementoTest>>testClassHasModelChangedElsewhere
        self value: self class.
        self memento reset.
        self deny: self memento hasModelChangedElsewhere

Several of the other tests use self write: instead of self value:, however this is what is used with components.

Code that makes the test work is:

MACheckedMemento>>reset
        super reset.
        self setOriginal: (self pullRawTransforming: [ :e | e isBehavior ifTrue: [ e ] ifFalse: [ e copy ] ])

Using isBehavior in a test is not ideal, it is better to have classes not copy themselves. That would have a large impact.

Class>>copy
	^ self

When experimenting with this, several of the browsers started raising errors (there is a giant X).

Posted by John Borden at 2 December 2023, 4:18 pm with tags Pier link

Stabilize Pier

Several weeks ago, loading Pier in a Pharo 10 image would fail with an error:

Warning: Package *Pier-Seaside depends on the following classes: GRPharoZnUtf8CodecStream You must resolve ...

Since then, someone has resolved the issue and it cleanly loads. It may have been a change to a project that Pier depends. Below are a list of recent changes merged into the main Pier branch:

  • Loading PRValueLink>>#redirectIn: raised errors because it sent #fromString: to PRLink. No similar classes implement this so it was replaced with #fromReference:
  • Pier Scheduled Tasks that have syntax errors can cause the whole webserver to crash, for example:

    PRScheduledTaskExamples newForKernelNamed: 'Pier') reportOfHistoryOnPageAt: '/example/line/should/begin/with/an/open/paran/Report'.

    adding this message allows it to be ignored instead:

    class compiler failBlock: [ :ignore | ]

  • Improve wiki search - the previous version would begin the search results page with: Your search for "..." - this could instead explain what the search was executed as, like: searching for "-bad good" excludes "bad" but includes "good"; it could be displayed as: NOT bad AND GOOD
  • Updated web scraping to reduce timeouts.
  • Updated workouts: so a test passes (replaced collectAll: with add:/addAll:).

Posted by John Borden at 3 October 2023, 12:00 am with tags Pier 1 comment link

Conflict in Memento

If you loaded Pier into a Pharo image after September, 2022, then it would likely bring up the following error when editing the settings:

 Add: Input is conflicting with concurrent modification

Tracing into this error, the cause is found in this Magritte commit, the error is in MACheckedMemento>>reset. Older code had:

self setOriginal: self pullRaw

The newer code has:

self setOriginal: (self pullRawTransforming: [ :e | e copy ])

When you click save, Magritte checks that the original in the memento matches the original model. For the PRPage in the environment field, the style sheet is a PRFile. The check fails since the memento contains a copy, not the original PRFile.

The Pier project is better off if it stays up-to-date with the projects that it depends on like Pillar and Magritte. The solution chosen to resolve this is to redefine the equals method so it is true for structures and their copies. The message #hash is related to equals, and is also redefined.

Posted by John Borden at 24 April 2023, 3:17 am with tags Pier link

Copy a Large File

For making backups, it is a common problem to copy a large tar file from one machine to another in the same network. Normally I would use commands like:

SourceServer> ncat -l --send-only 1701 < backup.tgz
DestinClient> ncat SourceServer 1701 > backup.tgz

Then compare the checksums:

DestinClient> cksum backup.tgz

This is taken from the NMap group. Recently a problem came up where the client did not have ncat, I thought to use Pharo instead so the client code is below (lifted from the SocketStream class comment):

| file socketStream result blocksize writeStream |
blocksize := 1024.
file := File openForWriteFileNamed: 'backup.tgz'.
[
	socketStream := SocketStream openConnectionToHostNamed: '127.0.0.1' port: 1701.
	[ [ socketStream binary.
		[ socketStream atEnd ]  whileFalse: [
			result := socketStream next: blocksize.
			file nextPutAll: result ] ]
	ensure: [ socketStream close ] ]
				on: ConnectionTimedOut
		do: [:ex | Transcript show: ex asString; cr. ex resume]
] ensure: [ file close ]

The address '127.0.0.1' needs to be changed to the IP where the ncat listener is already running once local testing is done.

Posted by John Borden at 11 March 2023, 4:57 pm link

Baseline Best Practices

With the Pharo project progressing as it has, it is necessary to load Pier on Pharo 9. This should also help to Retrieve HTTPS from Pharo.

A good introduction to baselines is on Github.

Pier work started with a separate baseline for core, add-ons, to-do, google, etc. This matched the setup on the previous code repository - Smalltalkhub. Problems would occur when loading the larger projects, the package dependencies are:
PierAddons -requires-> PierCore -requires-> Pillar
When everything cleanly loads, things work well. Recently Pillar loads with with dirty package (internal code is updated), so after loading PierCore, Pillar is attempted to reload when loading PierAddons. This causes the load time to drag on for an hour.

Another recent problem is that the tests would not load due to missing the core class PRObjectTest from the Pillar-Tests-Core package.

To bypass these problems, it was easier to create a large Pier baseline, which has labels for each of the possible parts - addons, todo, etc.

One way to test faster is create the BaselineOfPier class in the image and load it without writing to the repository.

Posted by John Borden at 23 August 2022, 1:44 am link
<< 1 2 3 4 5 6 7 8 9 10 >>