Giter VIP home page Giter VIP logo

Comments (16)

ziutek avatar ziutek commented on August 18, 2024

Please send me a full stack trace. If you can, send me info about requests table and its content that causes this issue. If you can't public original table description, try reproduce this issue on similar table/content.

from mymysql.

ex-troll avatar ex-troll commented on August 18, 2024
-- MySQL dump 10.13  Distrib 5.5.25a, for Linux (x86_64)
--
-- Host: localhost    Database: testbase
-- ------------------------------------------------------
-- Server version   5.5.25a-cll

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `requests`
--

DROP TABLE IF EXISTS `requests`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `requests` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `guid` varchar(21) COLLATE utf8_unicode_ci NOT NULL,
  `number` varchar(21) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `requests`
--

LOCK TABLES `requests` WRITE;
/*!40000 ALTER TABLE `requests` DISABLE KEYS */;
INSERT INTO `requests` VALUES (1,'qwe-asd-zxc','123');
/*!40000 ALTER TABLE `requests` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

What i need to do, to send you a full stack trace?

from mymysql.

AeroNotix avatar AeroNotix commented on August 18, 2024

I just want to say that this is probably the best bug report in the whole wide world. You should be proud.

from mymysql.

ex-troll avatar ex-troll commented on August 18, 2024

Sarcasm?
I'm bad know English.
I find it hard to describe the problem properly.
And i'm noob of golang.

from mymysql.

AeroNotix avatar AeroNotix commented on August 18, 2024

No no no no, I'm genuinely serious. I was impressed with the level of detail. No sarcasm!

from mymysql.

ex-troll avatar ex-troll commented on August 18, 2024

On home server i have old version of gdb. Don't have official updates to 7.1 or more.
How i can debugging?
Maybe i can put debug (some variables, iterators, interfaces, fields of packages) info to file and post it?
If you say what you need, i try to do it.

from mymysql.

AeroNotix avatar AeroNotix commented on August 18, 2024

Did you run the mymysql tests?

from mymysql.

ex-troll avatar ex-troll commented on August 18, 2024

On home server, i don't did this.
My mistake.

$ go test github.com/ziutek/mymysql/native
--- FAIL: TestUse (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestPing (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestQuery (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestPrepared (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestVarBinding (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestBindStruct (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestDate (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestBigBlob (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestEmpty (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestReconnect (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestSendLongData (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestNull (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestMultipleResults (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestDecimal (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestMediumInt (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
--- FAIL: TestStoredProcedures (0.00 seconds)
    native_test.go:43: Error: unexpected or unknown result packet
FAIL
FAIL    github.com/ziutek/mymysql/native    0.034s

from mymysql.

ex-troll avatar ex-troll commented on August 18, 2024

I am add some print to file in native/result.go

func doWrite(message string) error {
    f, err := os.OpenFile("/tmp/db_err.log", os.O_RDWR | os.O_APPEND | os.O_CREATE, 0666)
    if err != nil { return nil }

    defer f.Close()

    _, err = f.Write([]byte(message+"\n"))
    if err != nil { return nil }

    return nil
}

func (my *Conn) getResult(res *Result, row mysql.Row) *Result {
loop:
    pr := my.newPktReader() // New reader for next packet
    pkt0 := readByte(pr)

    doWrite("pkt0 = "+strconv.Itoa(int(pkt0)))

    if res == nil { doWrite("res = nil") } else { doWrite("res.status = "+strconv.Itoa(int(res.status))) }

    if pkt0 == 255 {
        // Error packet
        my.getErrorPacket(pr)
    }

    if res == nil {
        switch {
        case pkt0 == 0:
            // OK packet
            return my.getOkPacket(pr)

        case pkt0 > 0 && pkt0 < 251:
            // Result set header packet
            res = my.getResSetHeadPacket(pr)
            // Read next packet
            goto loop
        }
    } else {
        switch {
        case pkt0 == 254:
            // EOF packet
            res.warning_count, res.status = my.getEofPacket(pr)
            my.status = res.status
            return res

        case pkt0 > 0 && pkt0 < 251 && res.field_count < len(res.fields):
            // Field packet
            field := my.getFieldPacket(pr)
            res.fields[res.field_count] = field
            res.fc_map[field.Name] = res.field_count
            // Increment field count
            res.field_count++
            // Read next packet
            goto loop

        case pkt0 < 254 && res.field_count == len(res.fields):
            // Row Data Packet
            if len(row) != res.field_count {
                panic(ROW_LENGTH_ERROR)
            }
            if res.binary {
                my.getBinRowPacket(pr, res, row)
            } else {
                my.getTextRowPacket(pr, res, row)
            }
            return nil
        }
    }
    panic(UNK_RESULT_PKT_ERROR)
}

Then try to execute it on notebook:

$ go run untitled.go 
Id: 1
Guid: qwe-asd-zxc
Number: 123
$ cat /tmp/db_err.log 
pkt0 = 0
res = nil
pkt0 = 0
res = nil
pkt0 = 3
res = nil
pkt0 = 3
res.status = 0
pkt0 = 3
res.status = 0
pkt0 = 3
res.status = 0
pkt0 = 254
res.status = 0
pkt0 = 0
res.status = 2
pkt0 = 254
res.status = 2

Then try to execute it on home server:

$ go run untitled.go 
ERR: unexpected or unknown result packet
$ cat /tmp/db_err.log 
pkt0 = 254
res = nil

from mymysql.

AeroNotix avatar AeroNotix commented on August 18, 2024

Can you diff your mysql config files?

from mymysql.

ex-troll avatar ex-troll commented on August 18, 2024
$ diff notebook_my.cnf home_server_my.cnf 
1,25d0
< # Example MySQL config file for medium systems.
< #
< # This is for a system with little memory (32M - 64M) where MySQL plays
< # an important part, or systems up to 128M where MySQL is used together with
< # other programs (such as a web server)
< #
< # MySQL programs look for option files in a set of
< # locations which depend on the deployment platform.
< # You can copy this option file to one of those
< # locations. For information about these locations, see:
< # http://dev.mysql.com/doc/mysql/en/option-files.html
< #
< # In this file, you can use all long options that a program supports.
< # If you want to know which options a program supports, run the program
< # with the "--help" option.
< 
< # The following options will be passed to all MySQL clients
< [client]
< #password = your_password
< port      = 3306
< socket        = /var/run/mysql/mysql.sock
< 
< # Here follows entries for some specific programs
< 
< # The MySQL server
27,194c2,21
< port      = 3306
< socket        = /var/run/mysql/mysql.sock
< # Change following line if you want to store your database elsewhere
< datadir   = /var/lib/mysql
< skip-external-locking
< key_buffer_size = 16M
< max_allowed_packet = 1M
< table_open_cache = 64
< sort_buffer_size = 512K
< net_buffer_length = 8K
< read_buffer_size = 256K
< read_rnd_buffer_size = 512K
< myisam_sort_buffer_size = 8M
< 
< # Don't listen on a TCP/IP port at all. This can be a security enhancement,
< # if all processes that need to connect to mysqld run on the same host.
< # All interaction with mysqld must be made via Unix sockets or named pipes.
< # Note that using this option without enabling named pipes on Windows
< # (via the "enable-named-pipe" option) will render mysqld useless!
< # 
< #skip-networking
< 
< # Replication Master Server (default)
< # binary logging is required for replication
< log-bin=mysql-bin
< 
< # binary logging format - mixed recommended
< binlog_format=mixed
< 
< # required unique id between 1 and 2^32 - 1
< # defaults to 1 if master-host is not set
< # but will not function as a master if omitted
< server-id = 1
< 
< # Replication Slave (comment out master section to use this)
< #
< # To configure this host as a replication slave, you can choose between
< # two methods :
< #
< # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
< #    the syntax is:
< #
< #    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
< #    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
< #
< #    where you replace <host>, <user>, <password> by quoted strings and
< #    <port> by the master's port number (3306 by default).
< #
< #    Example:
< #
< #    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
< #    MASTER_USER='joe', MASTER_PASSWORD='secret';
< #
< # OR
< #
< # 2) Set the variables below. However, in case you choose this method, then
< #    start replication for the first time (even unsuccessfully, for example
< #    if you mistyped the password in master-password and the slave fails to
< #    connect), the slave will create a master.info file, and any later
< #    change in this file to the variables' values below will be ignored and
< #    overridden by the content of the master.info file, unless you shutdown
< #    the slave server, delete master.info and restart the slaver server.
< #    For that reason, you may want to leave the lines below untouched
< #    (commented) and instead use CHANGE MASTER TO (see above)
< #
< # required unique id between 2 and 2^32 - 1
< # (and different from the master)
< # defaults to 2 if master-host is set
< # but will not function as a slave if omitted
< #server-id       = 2
< #
< # The replication master for this slave - required
< #master-host     =   <hostname>
< #
< # The username the slave will use for authentication when connecting
< # to the master - required
< #master-user     =   <username>
< #
< # The password the slave will authenticate with when connecting to
< # the master - required
< #master-password =   <password>
< #
< # The port the master is listening on.
< # optional - defaults to 3306
< #master-port     =  <port>
< #
< # binary logging - not required for slaves, but recommended
< #log-bin=mysql-bin
< 
< # Uncomment the following if you are using InnoDB tables
< #innodb_data_home_dir = /var/lib/mysql
< #innodb_data_file_path = ibdata1:10M:autoextend
< #innodb_log_group_home_dir = /var/lib/mysql
< # You can set .._buffer_pool_size up to 50 - 80 %
< # of RAM but beware of setting memory usage too high
< #innodb_buffer_pool_size = 16M
< #innodb_additional_mem_pool_size = 2M
< # Set .._log_file_size to 25 % of buffer pool size
< #innodb_log_file_size = 5M
< #innodb_log_buffer_size = 8M
< #innodb_flush_log_at_trx_commit = 1
< #innodb_lock_wait_timeout = 50
< 
< # The safe_mysqld script
< [safe_mysqld]
< log-error = /var/log/mysql/mysqld.log
< socket        = /var/run/mysql/mysql.sock
< 
< [mysqldump]
< socket        = /var/run/mysql/mysql.sock
< quick
< max_allowed_packet = 16M
< 
< [mysql]
< no-auto-rehash
< # Remove the next comment character if you are not familiar with SQL
< #safe-updates
< 
< [myisamchk]
< key_buffer_size = 20M
< sort_buffer_size = 20M
< read_buffer = 2M
< write_buffer = 2M
< 
< [mysqlhotcopy]
< interactive-timeout
< 
< [mysqld_multi]
< mysqld     = /usr/bin/mysqld_safe
< mysqladmin = /usr/bin/mysqladmin
< log        = /var/log/mysqld_multi.log
< # user       = multi_admin
< # password   = secret
< 
< # If you want to use mysqld_multi uncomment 1 or more mysqld sections
< # below or add your own ones.
< 
< # WARNING
< # --------
< # If you uncomment mysqld1 than make absolutely sure, that database mysql,
< # configured above, is not started.  This may result in corrupted data!
< # [mysqld1]
< # port       = 3306
< # datadir    = /var/lib/mysql
< # pid-file   = /var/lib/mysql/mysqld.pid
< # socket     = /var/lib/mysql/mysql.sock
< # user       = mysql
< 
< # [mysqld2]
< # port       = 3307
< # datadir    = /var/lib/mysql-databases/mysqld2
< # pid-file   = /var/lib/mysql-databases/mysqld2/mysql.pid
< # socket     = /var/lib/mysql-databases/mysqld2/mysql.sock
< # user       = mysql
< 
< # [mysqld3]
< # port       = 3308
< # datadir    = /var/lib/mysql-databases/mysqld3
< # pid-file   = /var/lib/mysql-databases/mysqld3/mysql.pid
< # socket     = /var/lib/mysql-databases/mysqld3/mysql.sock
< # user       = mysql
< 
< # [mysqld6]
< # port       = 3309
< # datadir    = /var/lib/mysql-databases/mysqld6
< # pid-file   = /var/lib/mysql-databases/mysqld6/mysql.pid
< # socket     = /var/lib/mysql-databases/mysqld6/mysql.sock
< # user       = mysql
---
> datadir=/var/lib/mysql
> socket=/var/lib/mysql/mysql.sock
> user=mysql
> # Disabling symbolic-links is recommended to prevent assorted security risks
> symbolic-links=0
> 
> character-set-server=utf8
> collation-server=utf8_unicode_ci
> 
> tmp_table_size = 64
> max_heap_table_size = 64
> table_cache = 512
> 
> log-slow-queries=slow1.log
> long_query_time=2
> log-queries-not-using-indexes
> 
> [mysqld_safe]
> log-error=/var/log/mysqld.log
> pid-file=/var/run/mysqld/mysqld.pid
195a23,24
> [client]
> default-character-set=utf8

from mymysql.

AeroNotix avatar AeroNotix commented on August 18, 2024

Can you try the fix in this issue: #3

from mymysql.

ex-troll avatar ex-troll commented on August 18, 2024

olololololo..

from mymysql.

ex-troll avatar ex-troll commented on August 18, 2024

I'm just create a new user and it work! trololo!

from mymysql.

AeroNotix avatar AeroNotix commented on August 18, 2024

Seems like it was the password error reported in the linked issue.

from mymysql.

ziutek avatar ziutek commented on August 18, 2024

Fixed by last commit

from mymysql.

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.