InvictusInnovations / keyhotee

Decentralized ID and Communication
54 stars 27 forks source link

find contact doesn't check if the contact is already present. So crash is seen on find_contact if contact is not present in contact list. #405

Closed yuvarajgogoi closed 10 years ago

yuvarajgogoi commented 10 years ago

Steps to reproduce: 1) send a contact as attachment from client-1 to client-2 2) add this contact on the client-1 3) Now open the message again. 4) delete the added contact 5) do "find contact".

crash is seen

Tested in Debian and is always reproducible.

log:

1547190ms th_a startup ] . KeyhoteeApplication.cpp:449 1547191ms th_a get_profiles ] /home/yuvaraj/.local/share/Keyhotee/profiles/Y G application.cpp:466 1547191ms th_a get_profiles ] /home/yuvaraj/.local/share/Keyhotee/profiles/J G application.cpp:466 1547191ms th_a get_profiles ] profiles ["Y G","J G"] application.cpp:473 1547191ms th_a displayLogin ] . KeyhoteeApplication.cpp:383 1547202ms th_a get_profiles ] /home/yuvaraj/.local/share/Keyhotee/profiles/Y G application.cpp:466 1547202ms th_a get_profiles ] /home/yuvaraj/.local/share/Keyhotee/profiles/J G application.cpp:466 1547202ms th_a get_profiles ] profiles ["Y G","J G"] application.cpp:473 1547202ms th_a LoginDialog ] profiles Y G LoginDialog.cpp:42 1547202ms th_a LoginDialog ] profiles J G LoginDialog.cpp:42 1557644ms th_a open ] opening profile: /home/yuvaraj/.local/share/Keyhotee/profiles/Y G profile.cpp:119 1557644ms th_a open ] loading master key file:.keyhotee_master.key profile.cpp:135 1557663ms th_a open ] opening profile databases profile.cpp:147 1557849ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/addressbook/contact_db is not upgradeable upgrade_leveldb.cpp:24 1557905ms th_a open ] loading contact {"public_key":"0348f93ea2dc933090cf7f5a87511b6b6c753320e1ac92bb6bf591e4359eb456ae","dac_id_hash":11070383668416519960,"dac_id_string":"j","properties":[],"wallet_index":1,"auth_status":"accepted","privacy_setting":"secret_contact","first_name":"","last_name":"","icon_png":"","notes":"","next_send_trx_id":0,"send_trx_address":{"pub_key":"000000000000000000000000000000000000000000000000000000000000000000","chain_code":"0000000000000000000000000000000000000000000000000000000000000000"},"bitchat_recv_channels":[],"bitchat_broadcast_channels":[],"bitchat_recv_broadcast_key":"0000000000000000000000000000000000000000000000000000000000000000"} addressbook.cpp:59 1557922ms th_a open ] loading contact {"public_key":"033da84b6aa36682cad31ca0bc1cd0a06c8e41121004945285e2fd78b05df8b087","dac_id_hash":4782423505716984798,"dac_id_string":"jj","properties":[],"wallet_index":4,"auth_status":"unauthorized","privacy_setting":"secret_contact","first_name":"","last_name":"","icon_png":"","notes":"","next_send_trx_id":0,"send_trx_address":{"pub_key":"000000000000000000000000000000000000000000000000000000000000000000","chain_code":"0000000000000000000000000000000000000000000000000000000000000000"},"bitchat_recv_channels":[],"bitchat_broadcast_channels":[],"bitchat_recv_broadcast_key":"0000000000000000000000000000000000000000000000000000000000000000"} addressbook.cpp:59 1558017ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/idents is not upgradeable upgrade_leveldb.cpp:24 1558129ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/inbox/index is not upgradeable upgrade_leveldb.cpp:24 1558252ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/inbox/digest_to_data is not upgradeable upgrade_leveldb.cpp:24 1558342ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/inbox/digest_to_header is not upgradeable upgrade_leveldb.cpp:24 1558432ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/draft/index is not upgradeable upgrade_leveldb.cpp:24 1558524ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/draft/digest_to_data is not upgradeable upgrade_leveldb.cpp:24 1558614ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/draft/digest_to_header is not upgradeable upgrade_leveldb.cpp:24 1558771ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/pending/index is not upgradeable upgrade_leveldb.cpp:24 1558917ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/pending/digest_to_data is not upgradeable upgrade_leveldb.cpp:24 1559152ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/pending/digest_to_header is not upgradeable upgrade_leveldb.cpp:24 1559388ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/sent/index is not upgradeable upgrade_leveldb.cpp:24 1559535ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/sent/digest_to_data is not upgradeable upgrade_leveldb.cpp:24 1559704ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/sent/digest_to_header is not upgradeable upgrade_leveldb.cpp:24 1559794ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/spam/index is not upgradeable upgrade_leveldb.cpp:24 1559928ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/spam/digest_to_data is not upgradeable upgrade_leveldb.cpp:24 1560018ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/mail/spam/digest_to_header is not upgradeable upgrade_leveldb.cpp:24 1560107ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/chat/index is not upgradeable upgrade_leveldb.cpp:24 1560197ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/chat/digest_to_data is not upgradeable upgrade_leveldb.cpp:24 1560287ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/chat/digest_to_header is not upgradeable upgrade_leveldb.cpp:24 1560378ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/request/index is not upgradeable upgrade_leveldb.cpp:24 1560502ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/request/digest_to_data is not upgradeable upgrade_leveldb.cpp:24 1560592ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/request/digest_to_header is not upgradeable upgrade_leveldb.cpp:24 1560682ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/authorization/index is not upgradeable upgrade_leveldb.cpp:24 1560772ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/authorization/digest_to_data is not upgradeable upgrade_leveldb.cpp:24 1560862ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/authorization/digest_to_header is not upgradeable upgrade_leveldb.cpp:24 1560884ms th_a open ] loaded last_sync_time = 20140616T180222.018330 profile.cpp:166 1560885ms th_a open ] finished opening profile profile.cpp:167 1560898ms th_a configure ] application::configure application.cpp:301 1560898ms th_a configure ] configuring server application.cpp:333 1560898ms th_a configure ] listening for stcp connections on port 9876 server.cpp:208 1560898ms th_a configure ] configure bitname client application.cpp:339 1561030ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitname/bitname/channel/block_num_to_header is not upgradeable upgrade_leveldb.cpp:24 1561120ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitname/bitname/channel/block_num_to_name_trxs is not upgradeable upgrade_leveldb.cpp:24 1561209ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitname/bitname/channel/name_hash_to_locs is not upgradeable upgrade_leveldb.cpp:24 1561209ms th_a load_indexes ] load indexes bitname_db.cpp:100 1561209ms th_a load_indexes ] load indexes bitname_db.cpp:115 1561229ms th_a init_timekeeper ] ...init stats... bitname_db.cpp:170 1561229ms th_a init_timekeeper ] ...done init timekeeper... bitname_db.cpp:172 1561229ms th_a open ] open name db bitname_db.cpp:222 1561389ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitname/bitname/channel/forks/headers is not upgradeable upgrade_leveldb.cpp:24 1561537ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitname/bitname/channel/forks/blocks is not upgradeable upgrade_leveldb.cpp:24 1561683ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitname/bitname/channel/forks/forks is not upgradeable upgrade_leveldb.cpp:24 1561806ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitname/bitname/channel/forks/nexts is not upgradeable upgrade_leveldb.cpp:24 1561896ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitname/bitname/channel/forks/unknown is not upgradeable upgrade_leveldb.cpp:24 1561899ms th_a configure ] configure bitchat client application.cpp:349 1562019ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitchat/channel0/cache_chan_2/message_cache/by_id is not upgradeable upgrade_leveldb.cpp:24 1562120ms th_a UpgradeDbIfNecessary ] Database /home/yuvaraj/.local/share/Keyhotee/profiles/Y G/data/bitchat/channel0/cache_chan_2/message_cache/age_index1 is not upgradeable upgrade_leveldb.cpp:24 1562120ms th_a configure ] configuring rpc_server application.cpp:353 1562120ms th_a configure ] listening for rpc connections on port 9877 rpc_server.cpp:247 1562121ms th_a configure ] listening for rpc connections on port 9877 rpc_server.cpp:249 1562121ms th_a configure ] done configuring rpc_server application.cpp:356 1562121ms th_a configure ] end application::configure application.cpp:358 1562299ms th_a reloadContacts ] loading contacts... AddressBookModel.cpp:370 1562300ms th_a reloadContacts ] loading contacts... AddressBookModel.cpp:370 1562347ms th_a fillMailHeader ] 0 exception: unspecified Received a duplicate message, ignoring {} th_a MailboxModel.cpp:80 fillMailHeader MailboxModel.cpp:102 1562348ms th_a fillMailHeader ] 0 exception: unspecified Received a duplicate message, ignoring {} th_a MailboxModel.cpp:80 fillMailHeader MailboxModel.cpp:102 1562492ms th_a KeyhoteeMainWindow ] idents: [{"public_key":"033da84b6aa36682cad31ca0bc1cd0a06c8e41121004945285e2fd78b05df8b087","dac_id_hash":4782423505716984798,"dac_id_string":"jj","properties":[],"wallet_ident":"jj","mining_effort":0,"first_name":"","last_name":"","private_icon_png":""}] KeyhoteeMainWindow.cpp:259 1562509ms th_a start_mail_connect_l ] start_mail_connect_loop application.cpp:208 1562510ms th_a operator() ] Closing the mail connection (which may not be open) application.cpp:212 1562510ms th_a operator() ] Done closing the mail connection application.cpp:214 1567510ms th_a mail_connect_loop ] mail connect 127.0.0.1:7896, send sync_time=20140616T180222.018330 application.cpp:83 1567511ms th_a connect ] connect to 127.0.0.1:7896 and resolved ["127.0.0.1:7896"] mail_connection.cpp:229 1567517ms th_a connect ] connected to 127.0.0.1:7896 mail_connection.cpp:220 1567519ms th_a on_connection_messag ] last_sync_time now: 20140616T180222.018330 application.cpp:165 1567519ms th_a set_last_sync_time ] time=20140616T181207.758687 profile.cpp:86 1567559ms th_a on_connection_messag ] last_sync_time now: 20140616T181207.758687 application.cpp:165 1567559ms th_a set_last_sync_time ] time=20140616T181239.165210 profile.cpp:86 1567560ms th_a on_connection_messag ] last_sync_time now: 20140616T181239.165210 application.cpp:165 1567560ms th_a set_last_sync_time ] time=20140616T182103.456895 profile.cpp:86 1567978ms th_a handle_message ] recv: {"id":0,"error":{"message":"Key Not Found","code":0,"data":{"stack":[{"context":{"level":"error","file":"level_map.hpp","line":65,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083338.689851"},"format":"unable to find key ${key}","data":{"key":"JJ"}},{"context":{"level":"warn","file":"level_map.hpp","line":75,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083338.689882"},"format":"error fetching key ${key}","data":{"key":"JJ"}}],"type":"invalid_key","props":null}}} json_connection.cpp:69 1567979ms th_a close ] close 9 canceled_exception: Canceled Operation canceled {"message":"Operation canceled"} asio asio.cpp:17 read_write_handler json_connection.cpp:227 1567979ms th_a display_founderkey ] Founder Key Status exception: unspecified(0) unable to find key JJ error fetching key JJ NewIdentityDialog.cpp:148 1568406ms th_a handle_message ] recv: {"id":0,"error":{"message":"Key Not Found","code":0,"data":{"stack":[{"context":{"level":"error","file":"level_map.hpp","line":65,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083339.120738"},"format":"unable to find key ${key}","data":{"key":"JJ"}},{"context":{"level":"warn","file":"level_map.hpp","line":75,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083339.120786"},"format":"error fetching key ${key}","data":{"key":"JJ"}}],"type":"invalid_key","props":null}}} json_connection.cpp:69 1568407ms th_a close ] close 9 canceled_exception: Canceled Operation canceled {"message":"Operation canceled"} asio asio.cpp:17 read_write_handler json_connection.cpp:227 1568407ms th_a display_founderkey ] Founder Key Status exception: unspecified(0) unable to find key JJ error fetching key JJ NewIdentityDialog.cpp:148 1568866ms th_a handle_message ] recv: {"id":0,"error":{"message":"Key Not Found","code":0,"data":{"stack":[{"context":{"level":"error","file":"level_map.hpp","line":65,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083339.576014"},"format":"unable to find key ${key}","data":{"key":"JJ"}},{"context":{"level":"warn","file":"level_map.hpp","line":75,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083339.576062"},"format":"error fetching key ${key}","data":{"key":"JJ"}}],"type":"invalid_key","props":null}}} json_connection.cpp:69 1568867ms th_a close ] close 9 canceled_exception: Canceled Operation canceled {"message":"Operation canceled"} asio asio.cpp:17 read_write_handler json_connection.cpp:227 1568867ms th_a display_founderkey ] Founder Key Status exception: unspecified(0) unable to find key JJ error fetching key JJ NewIdentityDialog.cpp:148 1582018ms th_a store_contact ] to_string() addressbook.cpp:114 1582018ms th_a store_contact ] ... did it work? addressbook.cpp:116 1599260ms th_a handle_message ] recv: {"id":0,"error":{"message":"Key Not Found","code":0,"data":{"stack":[{"context":{"level":"error","file":"level_map.hpp","line":65,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083409.974944"},"format":"unable to find key ${key}","data":{"key":"JJ"}},{"context":{"level":"warn","file":"level_map.hpp","line":75,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083409.974979"},"format":"error fetching key ${key}","data":{"key":"JJ"}}],"type":"invalid_key","props":null}}} json_connection.cpp:69 1599261ms th_a close ] close 9 canceled_exception: Canceled Operation canceled {"message":"Operation canceled"} asio asio.cpp:17 read_write_handler json_connection.cpp:227 1599262ms th_a display_founderkey ] Founder Key Status exception: unspecified(0) unable to find key JJ error fetching key JJ NewIdentityDialog.cpp:148 1599704ms th_a handle_message ] recv: {"id":0,"error":{"message":"Key Not Found","code":0,"data":{"stack":[{"context":{"level":"error","file":"level_map.hpp","line":65,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083410.418204"},"format":"unable to find key ${key}","data":{"key":"JJ"}},{"context":{"level":"warn","file":"level_map.hpp","line":75,"method":"fetch","hostname":"","thread_name":"th_a","timestamp":"20140616T083410.418249"},"format":"error fetching key ${key}","data":{"key":"JJ"}}],"type":"invalid_key","props":null}}} json_connection.cpp:69 1599705ms th_a close ] close 9 canceled_exception: Canceled Operation canceled {"message":"Operation canceled"} asio asio.cpp:17 read_write_handler json_connection.cpp:227 1599706ms th_a display_founderkey ] Founder Key Status exception: unspecified(0) unable to find key JJ error fetching key JJ NewIdentityDialog.cpp:148 1602667ms th_a displayFailureInfo ] 10 assert_exception: Assert Exception contact_iterator != my->_contacts.end(): invalid contact id {} th_a AddressBookModel.cpp:332 getContactRow KeyhoteeApplication.cpp:428 1602667ms th_a displayFailureInfo ] fatal error 10 assert_exception: Assert Exception contact_iterator != my->_contacts.end(): invalid contact id {} th_a AddressBookModel.cpp:332 getContactRow KeyhoteeApplication.cpp:430