Error when editing taxon tree in specify7

Hi again,

I have another problem, when I try to edit the taxon tree (not the other trees), I have an error:

"Table 'taxontreedef' was not locked with LOCK TABLES"

In the logs I found:
field "_tableName" does not exist in <class 'specifyweb.specify.models.Taxon'>

I cannot reproduce this error in my test database, it seems that the taxon tree is not locked correctly ? I checked using specify6 and it doesn’t look locked by another user (don’t know how to get this info in the database)

Any idea what is happening here ?
Many thanks
Sylvie

Hi Sylvie,

That error is coming from the database system itself. Could you provide some more information on the version of Specify you are using along with your docker-compose.yml file?

You can run SHOW PROCESSLIST; to view running processes and identify if any ongoing operations are interfering with the taxontreedef table.

Specify utilizes a “tree lock” system that operates independently of the database, thus it should not be the cause of this issue.

It would be even more useful if you could provide us a copy of your SQL database backup. If manual edits were made or the tables are misconfigured, this would allow us to find those instances.

Hi,
I agree that the error is coming from the database, I don’t have it when using my dump from september in my testing environment but I made a new dump from production database after creating this ticket and restored it in test and the error showed up.
I don’t have PROCESS that seems to be idle so I don’t know what is wrong so I uploaded you my dump… if you think of something ? I am trying to compare both version of the databases but nothing shows up clearly.
Many thanks,
Sylvie

Hi @sfiat,

Apologies for the delay– we have been investigating this and have finally discovered what issue is causing this problem!

It is going to get a bit technical, so bear with me!

The problem is with the commonName field’s formatter in the Taxon table.

<format system="false" name="VIROT_idtax" class="edu.ku.brc.specify.datamodel.Taxon" fieldname="commonName">
    <autonumber>edu.ku.brc.af.core.db.AutoNumberGeneric</autonumber>
    <field type="constant" size="3" value="TAX"/>
    <field type="separator" size="1" value="-"/>
    <field type="numeric" size="5" inc="true"/>
</format>

Before saving an object, Specify locks the tables and fields associated with the record and it’s (auto-incrementing) formatters

https://github.com/specify/specify7/blob/8983e264b0887c46464a9a6e9dff5cecb069b6dd/specifyweb/specify/autonumbering.py#L41-L43

You can remove the formatter or set inc to false on the final line that defines the formatter:

    <field type="numeric" size="5" inc="false"/>

and then you will be able to create a new taxon successfully!

If you’d like to do this using Specify 6, you can follow these steps:

  1. Go to the Schema Configuration tool.

    From here, go to the table taxon and the field commonName .

  2. Click on the button next to the field format name.

  3. Click on the format VIROT_idtax and click on the pencil :pencil2: to edit.

  4. Click on the numeric section of the catalog number and disable auto-incrementing.

  5. Now in Specify 7, clear your browser’s cache (you can log in and out) and edit an item in the tree!


Unfortunately, this change means that you cannot auto-increment the field. Instead, you will need to enter a new number manually when creating a new Taxon record if you wish to continue using it as an identifier.

We’ve opened a GitHub issue to track this problem! Our developers are now aware of the issue. Thank you so much for your report!

Hi Grant,
Many thanks for investigating my error, I have disabled the “Is incrementer” check on VIROT_idtax and unfortunately I still have the same error when creating a new taxon… I tried login out and in again, closing browser, hard refreshing (Ctr+Alt+R) the page and even restarted the whole specify7 docker containers without success.
One interesting thing that might be of interest for you is that I have a (previous) backup of my database where the error doesn’t occur… may I send it to you ? I will try to keep investigating too…
Best
Sylvie

Hi Sylvie!

I’m sorry to hear the solution did not work for you.

Thankfully, we may be able to offer some further assistance.
The formatters for a field are defined in the UIFormatters App Resource.

If you need a refresher on App Resources in Specify 7, take a look at our documentation on the topic!
App Resources in Specify 7

In Specify 7, can you check the Field Format definition in the UIFormatters App Resource in the Discipline Resources?

The format causing the error is defined as the following:

<format system="false" name="VIROT_idtax" class="edu.ku.brc.specify.datamodel.Taxon" fieldname="commonName">
    <autonumber>edu.ku.brc.af.core.db.AutoNumberGeneric</autonumber>
    <field type="constant" size="3" value="TAX"/>
    <field type="separator" size="1" value="-"/>
    <field type="numeric" size="5" inc="true"/>
</format>

After editing the Field Format in Specify 6 and unchecking the ‘Is Incrementer’ checkbox, the formatter should have been updated to the following:

  <format system="false" name="VIROT_idtax" class="edu.ku.brc.specify.datamodel.Taxon" fieldname="commonName" default="true">
    <field type="constant" size="3" value="TAX"/>
    <field type="separator" size="1" value="-"/>
    <field type="numeric" size="5"/>
  </format>

Can you verify that this is the case?
If it is not the case, then can you try manually editing the UIFormatters in Specify 7 and replacing the prior VIROT_idtax format with the one provided above?

The below formatter is also equivalent and should work as well:

<format system="false" name="VIROT_idtax" class="edu.ku.brc.specify.datamodel.Taxon" fieldname="commonName">
    <autonumber>edu.ku.brc.af.core.db.AutoNumberGeneric</autonumber>
    <field type="constant" size="3" value="TAX"/>
    <field type="separator" size="1" value="-"/>
    <field type="numeric" size="5" inc="false"/>
</format>

:warning: After making these changes and saving the App Resource, please log out of Specify 7 and log back in. This is to ensure that Specify is not using the previously cached (stored) UIFormatters

If the formatter has been properly updated by Specify 6 and the error is still reproducible, then further investigation may be necessary and providing the previous backup of the database would be greatly appreciated!

Please reach out if you have any further questions or require clarification!

1 Like