hashtopolis / server

Hashtopolis - distributed password cracking with Hashcat
GNU General Public License v3.0
1.43k stars 213 forks source link

Cannot delete or update a parent row: a foreign key constraint fails #747

Closed emmettprexus closed 2 years ago

emmettprexus commented 2 years ago

Hashtopolis server: 0.12.0 Hashtopolis client: 0.6.1.6 Hashcat: 6.2.5 (ARM build)

I'm trying to delete a hash-list via the UI and API but get a 500. The following is in the error.log:

[php:error] [pid 137079] [client 192.168.1.49:51129] PHP Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (hashtopolis.AgentZap, CONSTRAINT AgentZap_ibfk_2 FOREIGN KEY (lastZapId) REFERENCES Zap (zapId)) in /var/www/html/dba/AbstractModelFactory.class.php:769\nStack trace:\n#0 /var/www/html/dba/AbstractModelFactory.class.php(769): PDOStatement->execute()\n#1 /var/www/html/inc/utils/HashlistUtils.class.php(510): DBA\\AbstractModelFactory->massDeletion()\n#2 /var/www/html/inc/handlers/HashlistHandler.class.php(65): HashlistUtils::delete()\n#3 /var/www/html/hashlists.php(31): HashlistHandler->handle()\n#4 {main}\n thrown in /var/www/html/dba/AbstractModelFactory.class.php on line 769, referer: http://x/hashlists.php

I was able to reproduce it:

  1. Create a hashlist
  2. Create a task
  3. While task is running, delete the task
  4. Delete the hashlist boom

This happens both using the UI and the API.

s3inlc commented 2 years ago

Can you please test if the fix in the issue/747 branch fixes your issue?

emmettprexus commented 2 years ago

Can you please test if the fix in the issue/747 branch fixes your issue?

I have tested the fix and can confirm that it is now working! Great!

zyronix commented 2 years ago

Created pull request for this, tested and can confirm that it is fixed.

s3inlc commented 2 years ago

Thanks for the feedback!